Compare commits

..

2 commits

Author SHA1 Message Date
Andy Teijelo
3ad4b16d66 dismiss notifications with Esc 2024-09-23 15:59:13 -04:00
Andy Teijelo
84874e4767 improve GoToBuffer keymaps 2024-09-23 15:37:07 -04:00
3 changed files with 19 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
@ -114,3 +120,9 @@ keymap("n", "<F11>", "<cmd>DapStepInto<CR>")
keymap("n", "<S-F11>", "<cmd>DapStepOut<CR>") keymap("n", "<S-F11>", "<cmd>DapStepOut<CR>")
vim.keymap.set("n", "K", require("noice.lsp").hover, { noremap = true, silent = true }) vim.keymap.set("n", "K", require("noice.lsp").hover, { noremap = true, silent = true })
local function dismiss_notifications()
require("notify").dismiss({ silent = true, pending = true })
vim.cmd("noh")
end
vim.keymap.set("n", "<Esc>", dismiss_notifications, { desc = "Dismiss notifications" })

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 = {