From 018a5741b7c7537a5ffc1074a25818d0d4eb119b Mon Sep 17 00:00:00 2001 From: tea Date: Sat, 10 Aug 2024 23:18:30 +0200 Subject: [PATCH] nvim: update which-key syntax --- .config/nvim/lua/my/coding.lua | 2 +- .config/nvim/lua/my/filetypes.lua | 2 +- .config/nvim/lua/my/git.lua | 8 ++++---- .config/nvim/lua/my/lsp.lua | 4 ++-- .config/nvim/lua/my/tools.lua | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.config/nvim/lua/my/coding.lua b/.config/nvim/lua/my/coding.lua index b18e994..c46a6e6 100644 --- a/.config/nvim/lua/my/coding.lua +++ b/.config/nvim/lua/my/coding.lua @@ -65,7 +65,7 @@ if vim.fn.executable('lldb-vscode') > 0 then dap.configurations.c = dap.configurations.cpp end -require('which-key').register({ ['d'] = { name = 'DAP' } }) +require('which-key').add({{ 'd', group = 'DAP' }}) map('n', 'dc', dap.continue, 'Continue') map('n', '', dap.step_over, 'DAP: step over') map('n', '', dap.step_into, 'DAP: step into') diff --git a/.config/nvim/lua/my/filetypes.lua b/.config/nvim/lua/my/filetypes.lua index 6660717..4836e56 100644 --- a/.config/nvim/lua/my/filetypes.lua +++ b/.config/nvim/lua/my/filetypes.lua @@ -15,7 +15,7 @@ require('ts_context_commentstring').setup({ vim.g.skip_ts_context_commentstring_module = true; -- disable backwards compat require('orgmode').setup {} -require('which-key').register({ ['o'] = { name = 'Orgmode' } }) +require('which-key').add({{ 'o', group = 'Orgmode' }}) local ffgroup = vim.api.nvim_create_augroup('config_ff', { clear = true }) vim.api.nvim_create_autocmd({ 'FileType' }, { diff --git a/.config/nvim/lua/my/git.lua b/.config/nvim/lua/my/git.lua index 7abff16..1282f4b 100644 --- a/.config/nvim/lua/my/git.lua +++ b/.config/nvim/lua/my/git.lua @@ -68,15 +68,15 @@ require('gitlinker').setup({ } }) -require('which-key').register({ ['g'] = { name = 'Git' } }) -require('which-key').register({ ['gc'] = { name = 'commit' } }) +require('which-key').add({{ 'g', group = 'Git' }}) +require('which-key').add({{ 'gc', group = 'commit' }}) map('n', 'gcc', ':Git commit', 'commit') map('n', 'gca', ':Git commit --amend', 'amend') map('n', 'gP', ':Git push', 'push') -require('which-key').register({ ['gp'] = { name = 'pull' } }) +require('which-key').add({{ 'gp', group = 'pull' }}) map('n', 'gpo', ':Git pull origin', 'origin') map('n', 'gpu', ':Git pull upstream', 'upstream') -require('which-key').register({ ['ga'] = { name = 'add' } }) +require('which-key').add({{ 'ga', group = 'add' }}) map('n', 'gau', ':Git add --update --patch', '--update --patch') map('n', 'ga%', ':Git add %', 'This file') map('n', 'gl', ':Git log --decorate', 'log') diff --git a/.config/nvim/lua/my/lsp.lua b/.config/nvim/lua/my/lsp.lua index 30e9312..c16a0ad 100644 --- a/.config/nvim/lua/my/lsp.lua +++ b/.config/nvim/lua/my/lsp.lua @@ -13,8 +13,8 @@ local on_attach = function(client, bufnr) map('n', 'gr', vim.lsp.buf.references, 'Show references', bufnr) map('n', 'K', vim.lsp.buf.hover, 'Hover', bufnr) map('i', '', vim.lsp.buf.hover, 'Hover', bufnr) - require('which-key').register({ ['l'] = { name = 'LSP' } }) - require('which-key').register({ ['lw'] = { name = 'workspace' } }) + require('which-key').add({{ 'l', group = 'LSP' }}) + require('which-key').add({{ 'lw', group = 'workspace' }}) map('n', 'lwa', vim.lsp.buf.add_workspace_folder, 'Add workspace folder', bufnr) map('n', 'lwr', vim.lsp.buf.remove_workspace_folder, diff --git a/.config/nvim/lua/my/tools.lua b/.config/nvim/lua/my/tools.lua index 8c39e4f..cbd2e36 100644 --- a/.config/nvim/lua/my/tools.lua +++ b/.config/nvim/lua/my/tools.lua @@ -29,7 +29,7 @@ telescope.setup({ local t_builtin = require('telescope.builtin') local my = require('my.functions') -require('which-key').register({ ['t'] = { name = 'Telescope' } }) +require('which-key').add({{ 't', group = 'Telescope' }}) map('n', 'tb', t_builtin.buffers, 'Buffers') map('n', 'tf', function() t_builtin.find_files({ cwd = my.get_project_root() }) @@ -144,7 +144,7 @@ map('n', '', mind_project, 'Open project mind') map('n', '', mind_project, 'Open project mind') -- = vim.g.table_mode_map_prefix = 'T' -require('which-key').register({ ['T'] = { name = 'Table mode' } }) +require('which-key').add({{ 'T', group = 'Table mode' }}) require('dressing').setup({ input = { @@ -163,7 +163,7 @@ vim.notify = require('notify') require('autolist').setup({}) -require('which-key').register({ ['j'] = { name = 'Jump' } }) +require('which-key').add({{ 'j', group = 'Jump' }}) map('n', 'ja', require('harpoon.mark').add_file, 'Add file') map('n', 'jm', require('harpoon.ui').toggle_quick_menu, 'Quick menu')