feat: which-key.nvim

This commit is contained in:
punkfairie 2024-12-01 15:24:45 -08:00
parent 82f8d85020
commit 46f5ab5a65
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
3 changed files with 82 additions and 0 deletions

View file

@ -53,6 +53,7 @@ with final.pkgs.lib; let
neo-tree-nvim neo-tree-nvim
grug-far-nvim grug-far-nvim
flash-nvim flash-nvim
which-key-nvim
]; ];
extraPackages = with pkgs; [ extraPackages = with pkgs; [

View file

@ -4,4 +4,5 @@ return {
req('flash-nvim'), req('flash-nvim'),
req('grug-far-nvim'), req('grug-far-nvim'),
req('neo-tree-nvim'), req('neo-tree-nvim'),
req('which-key-nvim'),
} }

View file

@ -0,0 +1,80 @@
return {
'which-key.nvim',
event = 'DeferredUIEnter',
keys = {
{
'<LEADER>?',
function()
require('which-key').show({ global = false })
end,
desc = 'buffer keymaps (which key)',
},
{
'<C-w><SPACE>',
function()
require('which-key').show({ keys = '<C-w>', 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' },
{ '<LEADER><TAB>', group = 'tabs' },
{ '<LEADER>c', group = 'code' },
{ '<LEADER>f', group = 'file/find' },
{ '<LEADER>g', group = 'git' },
{ '<LEADER>gh', group = 'hunks' },
{ '<LEADER>n', group = 'notifications' },
{ '<LEADER>q', group = 'quit/session' },
{ '<LEADER>s', group = 'search' },
{
'<LEADER>u',
group = 'ui',
icon = { icon = '󰙵 ', color = 'cyan' },
},
{
'<LEADER>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' },
{
'<LEADER>b',
group = 'buffer',
expand = function()
return require('which-key.extras').expand.buf()
end,
},
{
'<LEADER>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,
}