diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 9e8e67c..ee29733 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -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") diff --git a/.config/nvim/lua/key/Buffer.lua b/.config/nvim/lua/key/Buffer.lua new file mode 100644 index 0000000..c939b21 --- /dev/null +++ b/.config/nvim/lua/key/Buffer.lua @@ -0,0 +1,14 @@ +require("key/Rekey") + +-- New empty buffer. +remap_normal("n", "enew") + +-- Close buffer. +function _buf_close() + pcall(vim.cmd, "w") + vim.cmd[[bp|sp|bn|bd!]] +end +rekey_normal("x", "lua _buf_close()") + +-- Close all hidden buffers. +rekey_normal("X", "BDelete hidden") diff --git a/.config/nvim/lua/key/Navigation.lua b/.config/nvim/lua/key/Navigation.lua index c92c32c..27388f2 100644 --- a/.config/nvim/lua/key/Navigation.lua +++ b/.config/nvim/lua/key/Navigation.lua @@ -12,12 +12,6 @@ rekey_normal("Q", "BufferLineMovePrev") rekey_normal("e", "BufferLineCycleNext") rekey_normal("q", "BufferLineCyclePrev") --- Close buffer. -rekey_normal("x", "bpspbnbd") - --- Close all hidden buffers. -rekey_normal("X", "BDelete hidden") - -- Splits. rekey_normal("\\", "vsplit") rekey_normal("-", "split")