improve GoToBuffer keymaps

This commit is contained in:
Andy Teijelo 2024-09-23 15:37:07 -04:00
parent 9f54144f43
commit 84874e4767
3 changed files with 13 additions and 5 deletions

View file

@ -21,12 +21,18 @@ keymap("n", "<H>", "<Nop>", opts)
keymap("n", "<L>", "<Nop>", opts) keymap("n", "<L>", "<Nop>", opts)
keymap("n", "<M-L>", ":BufferLineMoveNext<CR>", opts) keymap("n", "<M-L>", ":BufferLineMoveNext<CR>", opts)
keymap("n", "<M-H>", ":BufferLineMovePrev<CR>", opts) keymap("n", "<M-H>", ":BufferLineMovePrev<CR>", opts)
function go_to_buffer(buffer)
return function()
require("bufferline").go_to(buffer, true)
end
end
for _, mode in ipairs({ "n", "i", "v" }) do for _, mode in ipairs({ "n", "i", "v" }) do
vim.keymap.set(mode, "<A-1>", "<Cmd>BufferLineGoToBuffer 1<CR>", { noremap = true, silent = true }) for i = 1, 8 do
vim.keymap.set(mode, "<A-2>", "<Cmd>BufferLineGoToBuffer 2<CR>", { noremap = true, silent = true }) vim.keymap.set(mode, "<A-" .. i .. ">", go_to_buffer(i), { noremap = true, silent = true })
vim.keymap.set(mode, "<A-3>", "<Cmd>BufferLineGoToBuffer 3<CR>", { noremap = true, silent = true }) end
vim.keymap.set(mode, "<A-4>", "<Cmd>BufferLineGoToBuffer 4<CR>", { noremap = true, silent = true }) vim.keymap.set(mode, "<A-9>", go_to_buffer(-1), { noremap = true, silent = true })
vim.keymap.set(mode, "<A-5>", "<Cmd>BufferLineGoToBuffer 5<CR>", { noremap = true, silent = true })
end end
-- Clear highlights -- Clear highlights

View file

@ -7,6 +7,7 @@ return {
win = { win = {
border = "single", border = "single",
}, },
delay = 1000,
}, },
}, },
{ {

View file

@ -1,5 +1,6 @@
return { return {
"folke/noice.nvim", "folke/noice.nvim",
commit = "d9328ef",
enabled = true, enabled = true,
opts = { opts = {
cmdline = { cmdline = {