diff --git a/configs/nvim/lua/lsp-setup.lua b/configs/nvim/lua/lsp-setup.lua index 853b45a..50009f2 100644 --- a/configs/nvim/lua/lsp-setup.lua +++ b/configs/nvim/lua/lsp-setup.lua @@ -44,22 +44,27 @@ local on_attach = function(_, bufnr) end -- document existing key chains -require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, +require('which-key').add { + { + { 'c', group = '[C]ode' }, + { 'd', group = '[D]ocument' }, + { 'g', group = '[G]it' }, + { 'h', group = 'Git [H]unk' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 't', group = '[T]oggle' }, + { 'w', group = '[W]orkspace' }, + }, } + -- register which-key VISUAL mode -- required for visual hs (hunk stage) to work -require('which-key').register({ - [''] = { name = 'VISUAL ' }, - ['h'] = { 'Git [H]unk' }, -}, { mode = 'v' }) +require('which-key').add { + { + { '', group = 'VISUAL ', mode = 'v' }, + { '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