update to which-key v3

This commit is contained in:
Adam 2024-07-15 03:05:13 -04:00
parent c481d7d8c9
commit c4db040b16

View file

@ -44,22 +44,27 @@ local on_attach = function(_, bufnr)
end
-- document existing key chains
require('which-key').register {
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
require('which-key').add {
{
{ '<leader>c', group = '[C]ode' },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>g', group = '[G]it' },
{ '<leader>h', group = 'Git [H]unk' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>w', group = '[W]orkspace' },
},
}
-- register which-key VISUAL mode
-- required for visual <leader>hs (hunk stage) to work
require('which-key').register({
['<leader>'] = { name = 'VISUAL <leader>' },
['<leader>h'] = { 'Git [H]unk' },
}, { mode = 'v' })
require('which-key').add {
{
{ '<leader>', group = 'VISUAL <leader>', mode = 'v' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
},
}
-- mason-lspconfig requires that these setup functions are called in this order
-- before setting up the servers.
@ -146,4 +151,15 @@ mason_lspconfig.setup_handlers {
end,
}
require('lspconfig').jdtls.setup {
cmd = { 'jdtls' },
-- Specify your workspace directory
root_dir = function(fname)
return require('lspconfig').util.root_pattern('pom.xml', '.git')(fname) or vim.loop.os_homedir()
end,
settings = {
java = {},
},
}
-- vim: ts=2 sts=2 sw=2 et