diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 782d5f0..d2da6ad 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -53,6 +53,7 @@ with final.pkgs.lib; let neo-tree-nvim grug-far-nvim flash-nvim + which-key-nvim ]; extraPackages = with pkgs; [ diff --git a/nvim/lua/plugins/editor/init.lua b/nvim/lua/plugins/editor/init.lua index 1c7ac76..ef2588d 100644 --- a/nvim/lua/plugins/editor/init.lua +++ b/nvim/lua/plugins/editor/init.lua @@ -4,4 +4,5 @@ return { req('flash-nvim'), req('grug-far-nvim'), req('neo-tree-nvim'), + req('which-key-nvim'), } diff --git a/nvim/lua/plugins/editor/which-key-nvim.lua b/nvim/lua/plugins/editor/which-key-nvim.lua new file mode 100644 index 0000000..2322155 --- /dev/null +++ b/nvim/lua/plugins/editor/which-key-nvim.lua @@ -0,0 +1,80 @@ +return { + 'which-key.nvim', + event = 'DeferredUIEnter', + keys = { + { + '?', + function() + require('which-key').show({ global = false }) + end, + desc = 'buffer keymaps (which key)', + }, + { + '', + function() + require('which-key').show({ keys = '', loop = true }) + end, + desc = 'window hydra mode (which key)', + }, + }, + before = function() + require('lz.n').trigger_load('mini.icons') + end, + after = function() + require('which-key').setup({ + preset = 'modern', + spec = { + { + mode = { 'n', 'v' }, + { '', group = 'tabs' }, + { 'c', group = 'code' }, + { 'f', group = 'file/find' }, + { 'g', group = 'git' }, + { 'gh', group = 'hunks' }, + { 'n', group = 'notifications' }, + { 'q', group = 'quit/session' }, + { 's', group = 'search' }, + { + 'u', + group = 'ui', + icon = { icon = '󰙵 ', color = 'cyan' }, + }, + { + 'x', + group = 'diagnostics/quickfix', + icon = { icon = '󱖫 ', color = 'green' }, + }, + { '[', group = 'previous' }, + { ']', group = 'next' }, + { 'g', group = 'goto' }, + { + 'gs', + group = 'surround', + icon = { icon = '󰅲', color = 'purple' }, + }, + { 'z', group = 'fold' }, + { + 'b', + group = 'buffer', + expand = function() + return require('which-key.extras').expand.buf() + end, + }, + { + 'w', + group = 'windows', + expand = function() + return require('which-key.extras').expand.win() + end, + }, + { 'gx', desc = 'Open with system app' }, + }, + }, + icons = { + rules = { + { pattern = 'explorer', icon = '󰙅' }, + }, + }, + }) + end, +}