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() local icons = require('icons') local colors = require('colors') 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 = colors.ui }, }, { 'x', group = 'diagnostics/quickfix', icon = { icon = '󱖫 ', color = colors.diagnostics }, }, { '[', group = 'previous' }, { ']', group = 'next' }, { 'g', group = 'goto' }, { 'gs', group = 'surround', icon = { icon = '󰅲', color = colors.surround }, }, { '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' }, { 'ur', icon = { icon = '', color = colors.ui } }, { '|', icon = { icon = '' } }, { '-', icon = { icon = '' } }, }, { mode = { 'n', 'i' }, hidden = true, { '' }, { '' }, { '' }, { '' }, }, { mode = { 'n', 'x' }, hidden = true, { 'j' }, { 'k' }, }, { mode = { 'v' }, { '<', icon = { icon = '󰉵' } }, { '>', icon = { icon = '󰉶' } }, }, }, icons = { rules = { { 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 = 'hunk', color = colors.git }, { pattern = 'diagnostic', icon = icons.diagnostics.Info, hl = 'DiagnosticInfo', }, { pattern = 'error', icon = icons.diagnostics.Error, hl = 'DiagnosticError', }, { pattern = ' warning', icon = icons.diagnostics.Warning, hl = 'DiagnosticWarn', }, }, }, }) end, }