-- Useful plugin to show you pending keybinds. -- https://github.com/folke/which-key.nvim return { 'folke/which-key.nvim', lazy = false, version = '*', priority = 1001, -- Make sure to load this as soon as possible dependencies = { 'nvim-lua/plenary.nvim', 'echasnovski/mini.icons', }, config = function() local wk = require 'which-key' wk.setup() wk.add { -- Better default experience { '', '', mode = { 'n', 'v' } }, -- ╭─────────────────────────────────────────────────────────╮ -- │ With leader │ -- ╰─────────────────────────────────────────────────────────╯ -- ── Buffer ────────────────────────────────────────────────────────── { 'b', group = '[b] Buffer', expand = function() return require('which-key.extras').expand.buf() end, }, { 'bk', ':blast', desc = 'Buffer: Last', mode = 'n' }, { 'bj', ':bfirst', desc = 'Buffer: First', mode = 'n' }, { 'bh', ':bprev', desc = 'Buffer: Prev', mode = 'n' }, { 'bl', ':bnext', desc = 'Buffer: Next', mode = 'n' }, { 'bd', ':Bdelete', desc = 'Buffer: Delete', mode = 'n' }, { 'bw', ':Bwipeout', desc = 'Buffer: Wipeout', mode = 'n' }, -- ── Code ──────────────────────────────────────────────────────────── { 'c', group = '[c] Code' }, -- ── Code: CommentBox ──────────────────────────────────────────────── { 'cb', group = 'CommentBox' }, { 'cbb', 'CBccbox', desc = 'CommentBox: Box Title' }, { 'cbd', 'CBd', desc = 'CommentBox: Remove a box' }, { 'cbl', 'CBline', desc = 'CommentBox: Simple Line' }, { 'cbm', 'CBllbox14', desc = 'CommentBox: Marked' }, { 'cbt', 'CBllline', desc = 'CommentBox: Titled Line' }, { 'd', group = '[d] DAP' }, -- See: lua/plugins/dap.lua { 'g', group = '[g] Git' }, -- See: lua/plugins/git.lua { 'h', group = '[h] Harpoon' }, -- See: lua/plugins/harpoon.lua { 'l', group = '[l] LSP' }, -- See: lua/plugins/lsp.lua -- ── Quit ──────────────────────────────────────────────────────────── { 'q', group = '[q] Quit' }, { 'qf', ':q', desc = 'Quicker close split' }, { 'qq', ':wq!', desc = 'Quit with force saving' }, { 'qw', ':wq', desc = 'Write and quit' }, { 's', group = '[s] Search' }, -- See: lua/plugins/telescope.lua -- ── Toggle ────────────────────────────────────────────────────────── { 't', group = '[t] Toggle' }, { 'tt', ':TransparentToggle', desc = 'Toggle Transparency' }, { 'ts', ':noh', desc = 'Toggle Search Highlighting' }, { 'w', group = '[w] Workspace' }, { 'x', group = '[x] Trouble' }, { 'z', group = '[z] FZF' }, -- ── Help ──────────────────────────────────────────────────────────── { '?', group = '[?] Help' }, { '?w', function() wk.show { global = false } end, desc = 'Buffer Local Keymaps (which-key)', }, -- ╭─────────────────────────────────────────────────────────╮ -- │ Without leader │ -- ╰─────────────────────────────────────────────────────────╯ { 'y', group = 'Yank & Surround' }, -- ── Old habits ────────────────────────────────────────────────────── { '', ':w', desc = 'Save file' }, -- ── Text manipulation in visual mode ──────────────────────────────── { '>', '>gv', desc = 'Indent Right', mode = 'v' }, { '<', '+1gv=gv", desc = 'Move Block Down', mode = 'v' }, { 'K', ":m '<-2gv=gv", desc = 'Move Block Up', mode = 'v' }, -- ── Misc keybinds ─────────────────────────────────────────────────── { 'QQ', ':q!', desc = 'Quit without saving' }, { 'WW', ':w!', desc = 'Force write to file' }, { 'ss', ':noh', desc = 'Clear Search Highlighting' }, { 'jj', '', desc = 'Esc without touching esc in insert mode', mode = 'i' }, -- ── Splits ────────────────────────────────────────────────────────── -- Use CTRL+ to switch between windows in normal mode -- See `:help wincmd` for a list of all window commands { '', '', desc = 'Move focus to the left window' }, { '', '', desc = 'Move focus to the right window' }, { '', '', desc = 'Move focus to the lower window' }, { '', '', desc = 'Move focus to the upper window' }, -- Split resizing { ',', ':vertical resize -10', desc = 'V Resize -' }, { '.', ':vertical resize +10', desc = 'V Resize +' }, -- ── Disable arrow keys in normal mode ─────────────────────────────── { '', 'echo "Use h to move!!"' }, { '', 'echo "Use l to move!!"' }, { '', 'echo "Use k to move!!"' }, { '', 'echo "Use j to move!!"' }, -- ── Terminal ──────────────────────────────────────────────────────── -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which -- is not what someone will guess without a bit more experience. -- -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping -- or just use to exit terminal mode. { '', '', desc = 'Exit terminal mode', mode = 't' }, -- ── Search ────────────────────────────────────────────────────────── -- :noh if you have search highlights { '', ':noh', desc = 'Clear search highlights' }, } end, }