From a1c0ecfba40e028d4d730a561fef322bcee97365 Mon Sep 17 00:00:00 2001 From: triethyl Date: Sat, 27 Sep 2025 20:02:16 -0400 Subject: neovim: bunch of stuff --- pkgs/custom-neovim/config/lua/keymaps.lua | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'pkgs/custom-neovim/config/lua/keymaps.lua') diff --git a/pkgs/custom-neovim/config/lua/keymaps.lua b/pkgs/custom-neovim/config/lua/keymaps.lua index efaa7d7..6c3a3bd 100644 --- a/pkgs/custom-neovim/config/lua/keymaps.lua +++ b/pkgs/custom-neovim/config/lua/keymaps.lua @@ -1,3 +1,7 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ Keymaps │ +-- ╰─────────────────────────────────────────────────────────╯ + -- Create keymap function local mapkey = function(mode, key, desc, action, plugin) local keymapper = plugin and require("lz.n").keymap(plugin).set or vim.keymap.set @@ -11,7 +15,6 @@ vim.g.mapleader = " " mapkey("n", "f", "Open file picker", ":Pick files", "mini.pick") mapkey("n", "o", "Open old file picker", ":Pick oldfiles", "mini.pick") mapkey("n", "/", "Open live grep picker", ":Pick grep_live", "mini.pick") -mapkey("n", "b", "Open buffer picker", ":Pick buffers", "mini.pick") mapkey("n", "k", "Open colorscheme picker", ":Pick colorschemes", "mini.pick") -- File manager @@ -35,6 +38,23 @@ mapkey("n", "tT", "Go to previous tab", ":tabp") mapkey("n", "to", "Open new tab", ":tabnew") mapkey("n", "tc", "Close current tab", ":tabclose") +-- Buffers +mapkey("n", "b", "Manage buffers", "") +mapkey("n", "bb", "Open buffer picker", ":Pick buffers", "mini.pick") +mapkey("n", "bc", "Clear invisible buffers", function () + local bufinfos = vim.fn.getbufinfo({buflisted = 1}) + vim.tbl_map(function (bufinfo) + if bufinfo.changed == 0 and (not bufinfo.windows or #bufinfo.windows == 0) then + vim.api.nvim_buf_delete(bufinfo.bufnr, {force = false, unload = false}) + vim.cmd.redrawtabline() + end + end, bufinfos) +end) + +-- Comment box +mapkey("n", "j", "Manage comment graphics", "") +mapkey("n", "jb", "Create comment box", ":CB") + -- Session mapkey("n", "w", "Manage sessions", "") mapkey("n", "ww", "Open a session", ":Autosession search", "mini.pick") -- cgit v1.2.3