summaryrefslogtreecommitdiff
path: root/pkgs/custom-neovim/config/lua/keymaps.lua
diff options
context:
space:
mode:
authortriethyl <triethylammonium@pm.me>2025-09-27 20:02:16 -0400
committertriethyl <triethylammonium@pm.me>2025-09-27 20:02:16 -0400
commita1c0ecfba40e028d4d730a561fef322bcee97365 (patch)
treed3249d849b2b845cd8c0199532ba1c191f09c7c8 /pkgs/custom-neovim/config/lua/keymaps.lua
parent3399daae1d7baff4be3ae953ae32a9358962ef67 (diff)
neovim: bunch of stuff
Diffstat (limited to 'pkgs/custom-neovim/config/lua/keymaps.lua')
-rw-r--r--pkgs/custom-neovim/config/lua/keymaps.lua22
1 files changed, 21 insertions, 1 deletions
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", "<leader>f", "Open file picker", ":Pick files<cr>", "mini.pick")
mapkey("n", "<leader>o", "Open old file picker", ":Pick oldfiles<cr>", "mini.pick")
mapkey("n", "<leader>/", "Open live grep picker", ":Pick grep_live<cr>", "mini.pick")
-mapkey("n", "<leader>b", "Open buffer picker", ":Pick buffers<cr>", "mini.pick")
mapkey("n", "<leader>k", "Open colorscheme picker", ":Pick colorschemes<cr>", "mini.pick")
-- File manager
@@ -35,6 +38,23 @@ mapkey("n", "<leader>tT", "Go to previous tab", ":tabp<cr>")
mapkey("n", "<leader>to", "Open new tab", ":tabnew<cr>")
mapkey("n", "<leader>tc", "Close current tab", ":tabclose<cr>")
+-- Buffers
+mapkey("n", "<leader>b", "Manage buffers", "")
+mapkey("n", "<leader>bb", "Open buffer picker", ":Pick buffers<cr>", "mini.pick")
+mapkey("n", "<leader>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", "<leader>j", "Manage comment graphics", "")
+mapkey("n", "<leader>jb", "Create comment box", ":CB")
+
-- Session
mapkey("n", "<leader>w", "Manage sessions", "")
mapkey("n", "<leader>ww", "Open a session", ":Autosession search<cr>", "mini.pick")