marleyvim/nvim/lua/plugins/editor/which-key-nvim.lua

131 lines
3.6 KiB
Lua
Raw Normal View History

2024-12-01 15:24:45 -08:00
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()
2024-12-01 17:10:02 -08:00
local icons = require('icons')
local colors = require('colors')
2024-12-01 15:24:45 -08:00
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',
2024-12-01 17:10:02 -08:00
icon = { icon = '󰙵 ', color = colors.ui },
2024-12-01 15:24:45 -08:00
},
{
'<LEADER>x',
group = 'diagnostics/quickfix',
2024-12-01 17:10:02 -08:00
icon = { icon = '󱖫 ', color = colors.diagnostics },
2024-12-01 15:24:45 -08:00
},
{ '[', group = 'previous' },
{ ']', group = 'next' },
{ 'g', group = 'goto' },
{
'gs',
group = 'surround',
2024-12-01 17:10:02 -08:00
icon = { icon = '󰅲', color = colors.surround },
2024-12-01 15:24:45 -08:00
},
{ '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,
},
2024-12-01 17:10:02 -08:00
{ 'gx', desc = 'open with system app' },
{ '<LEADER>ur', icon = { icon = '', color = colors.ui } },
{ '<LEADER>|', icon = { icon = '' } },
{ '<LEADER>-', icon = { icon = '' } },
},
{
mode = { 'n', 'i' },
hidden = true,
{ '<DOWN>' },
{ '<UP>' },
{ '<LEFT>' },
{ '<RIGHT>' },
},
{
mode = { 'n', 'x' },
hidden = true,
{ 'j' },
{ 'k' },
},
{
mode = { 'v' },
{ '<', icon = { icon = '󰉵' } },
{ '>', icon = { icon = '󰉶' } },
2024-12-01 15:24:45 -08:00
},
},
icons = {
rules = {
2024-12-01 17:10:02 -08:00
{ pattern = 'explorer', icon = '󰙅', color = colors.explorer },
{ pattern = 'lazygit', icon = '' },
{ pattern = 'comment', icon = '' },
{ pattern = 'buffer', color = colors.buffer },
{
pattern = 'notification',
icon = '󰈸',
color = colors.notifications,
},
{ pattern = 'message', icon = '󰈸', color = colors.notifications },
{ pattern = 'session', icon = '', color = colors.sessions },
{
pattern = 'diagnostic',
icon = icons.diagnostics.Info,
hl = 'DiagnosticInfo',
},
{
pattern = 'error',
icon = icons.diagnostics.Error,
hl = 'DiagnosticError',
},
{
pattern = ' warning',
icon = icons.diagnostics.Warning,
hl = 'DiagnosticWarn',
},
2024-12-01 15:24:45 -08:00
},
},
})
end,
}