Nvim : Improve <Leader>x buffer close.
This commit is contained in:
parent
13f0a96510
commit
f10abfc83d
|
@ -8,6 +8,7 @@ require("config/Search")
|
|||
require("config/Tab")
|
||||
|
||||
require("key/Autocomplete")
|
||||
require("key/Buffer")
|
||||
require("key/Comment")
|
||||
require("key/Common")
|
||||
require("key/Filetree")
|
||||
|
|
14
.config/nvim/lua/key/Buffer.lua
Normal file
14
.config/nvim/lua/key/Buffer.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
require("key/Rekey")
|
||||
|
||||
-- New empty buffer.
|
||||
remap_normal("<Leader>n", "<cmd>enew<cr>")
|
||||
|
||||
-- Close buffer.
|
||||
function _buf_close()
|
||||
pcall(vim.cmd, "w")
|
||||
vim.cmd[[bp|sp|bn|bd!]]
|
||||
end
|
||||
rekey_normal("<Leader>x", "<cmd>lua _buf_close()<cr>")
|
||||
|
||||
-- Close all hidden buffers.
|
||||
rekey_normal("<Leader>X", "<cmd>BDelete hidden<cr><C-l>")
|
|
@ -12,12 +12,6 @@ rekey_normal("<Leader>Q", "<cmd>BufferLineMovePrev<cr>")
|
|||
rekey_normal("<Leader>e", "<cmd>BufferLineCycleNext<cr>")
|
||||
rekey_normal("<Leader>q", "<cmd>BufferLineCyclePrev<cr>")
|
||||
|
||||
-- Close buffer.
|
||||
rekey_normal("<Leader>x", "<cmd>bp<bar>sp<bar>bn<bar>bd<cr>")
|
||||
|
||||
-- Close all hidden buffers.
|
||||
rekey_normal("<Leader>X", "<cmd>BDelete hidden<cr><C-l>")
|
||||
|
||||
-- Splits.
|
||||
rekey_normal("<Leader>\\", "<cmd>vsplit<cr>")
|
||||
rekey_normal("<Leader>-", "<cmd>split<cr>")
|
||||
|
|
Reference in a new issue