From 77f0411be1765d9ec3b30eb87446411a18eadc14 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 8 Jul 2024 15:35:14 +0200 Subject: [PATCH] whichkey actual fix --- lua/custom/plugins/telescope.lua | 2 +- lua/custom/plugins/ui.lua | 75 +++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/lua/custom/plugins/telescope.lua b/lua/custom/plugins/telescope.lua index 52ab28b..284c8a1 100644 --- a/lua/custom/plugins/telescope.lua +++ b/lua/custom/plugins/telescope.lua @@ -92,7 +92,7 @@ return { vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', 'fb', builtin.buffers, { desc = '[F]ind existing [B]uffers' }) vim.keymap.set('n', 'fm', builtin.marks, { desc = '[F]ind book[M]arks' }) - vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind LSP [D]iagnostigs' }) + vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostigs' }) vim.keymap.set('n', 'fs', builtin.lsp_dynamic_workspace_symbols, { desc = '[F]ind LSP [S]ymbols' }) -- spelling diff --git a/lua/custom/plugins/ui.lua b/lua/custom/plugins/ui.lua index bd2365e..7176583 100644 --- a/lua/custom/plugins/ui.lua +++ b/lua/custom/plugins/ui.lua @@ -141,23 +141,6 @@ return { { 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' - keys = { '', '', '', '', '"', "'", '`', 'c', 'v', 'g' }, - defaults = { - mode = { 'n', 'v' }, - [';'] = { name = '+telescope' }, - [';f'] = { name = '+find' }, - ['g'] = { name = '+goto' }, - [']'] = { name = '+next' }, - ['['] = { name = '+prev' }, - ['d'] = { name = '+[D]ebug' }, - ['c'] = { name = '+[C]ode/[C]olor' }, - ['g'] = { name = '+[G]ood tools' }, - ['f'] = { name = '+[F]ormatting' }, - ['r'] = { name = '[R]ename' }, - ['f'] = { name = '[F]ind' }, - ['w'] = { name = '[W]orkspace' }, - ['t'] = { name = '[T]oggle' }, - }, opts = { triggers_nowait = { -- marks @@ -180,7 +163,51 @@ return { v = { 'j', 'k' }, n = { 'o', 'O' }, }, + -- plugins = { + -- marks = true, -- shows a list of your marks on ' and ` + -- registers = true, -- shows your registers on " in NORMAL or in INSERT mode + -- -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- -- No actual key bindings are created + -- spelling = { + -- enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions + -- suggestions = 20, -- how many suggestions should be shown in the list? + -- }, + -- presets = { + -- operators = true, -- adds help for operators like d, y, ... + -- motions = true, -- adds help for motions + -- text_objects = true, -- help for text objects triggered after entering an operator + -- windows = true, -- default bindings on + -- nav = true, -- misc bindings to work with windows + -- z = true, -- bindings for folds, spelling and others prefixed with z + -- g = true, -- bindings for prefixed with g + -- }, + -- }, + icons = { + breadcrumb = '»', -- symbol used in the command line area that shows your active key combo + separator = '➜', -- symbol used between a key and it's label + group = '+', -- symbol prepended to a group + }, }, + config = function(opts) + local wk = require 'which-key' + local defaults = { + mode = { 'n', 'v' }, + [';'] = { name = '+telescope' }, + [';f'] = { name = '+find' }, + ['g'] = { name = '+goto' }, + [']'] = { name = '+next' }, + ['['] = { name = '+prev' }, + ['d'] = { name = '+[D]ebug' }, + ['c'] = { name = '+[C]ode/[C]olor' }, + ['g'] = { name = '+[G]ood tools' }, + ['f'] = { name = '+[F]ormatting' }, + ['r'] = { name = '[R]ename' }, + ['f'] = { name = '[F]ind' }, + ['w'] = { name = '[W]orkspace' }, + ['t'] = { name = '[T]oggle', ['🚫'] = 'which_key_ignore' }, + } + wk.register(defaults, opts) + end, }, { 'echasnovski/mini.trailspace', @@ -294,14 +321,12 @@ return { 'folke/todo-comments.nvim', lazy = false, dependencies = 'nvim-telescope/telescope.nvim', - -- stylua: ignore - keys = { - { ']t', function() require('todo-comments').jump_next() end, desc = 'Next todo comment' }, - { '[t', function() require('todo-comments').jump_prev() end, desc = 'Previous todo comment' }, - { 'fdt', 'TodoTelescope', desc = 'todo' }, - { 'xt', 'TodoTrouble', desc = 'Todo (Trouble)' }, - { 'xT', 'TodoTrouble keywords=TODO,FIX,FIXME', desc = 'Todo/Fix/Fixme (Trouble)' }, - }, + -- stylua: ignore + keys = { + { ']t', function() require('todo-comments').jump_next() end, desc = 'Next todo comment' }, + { '[t', function() require('todo-comments').jump_prev() end, desc = 'Previous todo comment' }, + { 'fdt', 'TodoTelescope', desc = 'todo' }, + }, opts = { signs = true, keywords = {