From 7467182bc299c8188b1b0bbcd57bfd29dc9738f0 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Sun, 22 Jun 2025 22:25:15 +0200 Subject: [PATCH] Keymaps for buffers. --- config/common/nvim/lua/config/keymaps.lua | 29 +++++++++++++++-------- config/common/nvim/lua/plugins/init.lua | 9 +++++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/config/common/nvim/lua/config/keymaps.lua b/config/common/nvim/lua/config/keymaps.lua index 5d165de..e662278 100644 --- a/config/common/nvim/lua/config/keymaps.lua +++ b/config/common/nvim/lua/config/keymaps.lua @@ -16,6 +16,8 @@ nomap("n", "L") nomap("n", "S") nomap("n", "`") +nomap("n", "bb") +nomap("n", "bd") nomap("n", "bD") nomap("n", "bP") nomap("n", "bl") @@ -54,20 +56,27 @@ nomap("n", "xq") map("i", "", "I") map("i", "", "A") -map("n", "", "wq!", { desc = "save and exit", remap = true }) -map("n", "", "w", { desc = "switch pane", remap = true }) -map("n", "-", "s", { desc = "split horizontally", remap = true }) -map("n", "|", "v", { desc = "split vertically", remap = true }) -map("n", "/", "gcc", { desc = "toggle comments", remap = true }) +map("n", "", "wq!", { desc = "Save and Exit", remap = true }) +map("n", "", "w", { desc = "Switch Pane", remap = true }) +map("n", "-", "s", { desc = "Split Horizontally", remap = true }) +map("n", "|", "v", { desc = "Split Vertically", remap = true }) +map("n", "/", "gcc", { desc = "Toggle Comments", remap = true }) -map("n", "fF", LazyVim.pick("files", { root = false }), { desc = "find files (root)", remap = true }) -map("n", "ff", LazyVim.pick("files"), { desc = "find files (cwd)", remap = true }) -map("n", "h", "set hlsearch!", { desc = "toggle hlsearch", remap = true }) +map("n", "bn", "enew", { desc = "New Buffer", remap = true }) +map("n", "bl", "bnext", { desc = "Next Buffer", remap = true }) +map("n", "bh", "bprevious", { desc = "Previous Buffer", remap = true }) +map("n", "bq", function() + Snacks.bufdelete() +end, { desc = "Delete Buffer" }) + +map("n", "fF", LazyVim.pick("files", { root = false }), { desc = "Find Files (root)", remap = true }) +map("n", "ff", LazyVim.pick("files"), { desc = "Find Files (cwd)", remap = true }) +map("n", "h", "set hlsearch!", { desc = "Toggle hlsearch", remap = true }) map( "n", "m", 'execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")', - { desc = "toggle column", remap = true } + { desc = "Toggle Columns", remap = true } ) -- n (toggle decorations) moved to configuration of snacks.nvim in plugins/init.lua -map("v", "/", "gc", { desc = "toggle comments", remap = true }) +map("v", "/", "gc", { desc = "Toggle Comments", remap = true }) diff --git a/config/common/nvim/lua/plugins/init.lua b/config/common/nvim/lua/plugins/init.lua index dc6b2f9..1a4feef 100644 --- a/config/common/nvim/lua/plugins/init.lua +++ b/config/common/nvim/lua/plugins/init.lua @@ -7,6 +7,15 @@ return { { "folke/trouble.nvim", enabled = false }, { "windwp/nvim-ts-autotag", enabled = false }, + { + "akinsho/bufferline.nvim", + opts = { + options = { + always_show_bufferline = true, + }, + }, + }, + { "folke/snacks.nvim", opts = {