chore: Update which-key mappings to new standard
This commit is contained in:
parent
dba5d1c1c1
commit
c9c15d8ae1
1 changed files with 36 additions and 17 deletions
|
@ -76,15 +76,15 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set name for the <space>l prefix
|
-- Set name for the <space>l prefix
|
||||||
keymap.set('n', 'gD', vim.lsp.buf.declaration, desc('lsp [g]o to [D]eclaration'))
|
keymap.set('n', 'gD', vim.lsp.buf.declaration, { desc = 'lsp [g]o to [D]eclaration' })
|
||||||
keymap.set('n', 'gd', vim.lsp.buf.definition, desc('lsp [g]o to [d]efinition'))
|
keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = 'lsp [g]o to [d]efinition' })
|
||||||
keymap.set('n', 'K', vim.lsp.buf.hover, desc('[lsp] hover'))
|
keymap.set('n', 'K', vim.lsp.buf.hover, { desc = '[lsp] hover' })
|
||||||
keymap.set('n', 'gi', vim.lsp.buf.implementation, desc('lsp [g]o to [i]mplementation'))
|
keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = 'lsp [g]o to [i]mplementation' })
|
||||||
keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, desc('[lsp] signature help'))
|
keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, { desc = '[lsp] signature help' })
|
||||||
keymap.set('n', '<M-CR>', vim.lsp.buf.code_action, desc('[lsp] code action'))
|
keymap.set('n', '<M-CR>', vim.lsp.buf.code_action, { desc = '[lsp] code action' })
|
||||||
keymap.set('n', '<M-l>', vim.lsp.codelens.run, desc('[lsp] run code lens'))
|
keymap.set('n', '<M-l>', vim.lsp.codelens.run, { desc = '[lsp] run code lens' })
|
||||||
keymap.set('n', 'gr', vim.lsp.buf.references, desc('lsp [g]et [r]eferences'))
|
keymap.set('n', 'gr', vim.lsp.buf.references, { desc = 'lsp [g]et [r]eferences' })
|
||||||
wk.register({
|
--[[ wk.register({
|
||||||
l = {
|
l = {
|
||||||
name = "[l]sp",
|
name = "[l]sp",
|
||||||
g = {
|
g = {
|
||||||
|
@ -111,14 +111,33 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
R = { "<cmd>vim.lsp.codelens.refresh<cr>", '[l]sp code lenses [R]efresh' },
|
R = { "<cmd>vim.lsp.codelens.refresh<cr>", '[l]sp code lenses [R]efresh' },
|
||||||
f = { function() vim.lsp.buf.format { async = true } end, '[l]sp [f]ormat buffer' },
|
f = { function() vim.lsp.buf.format { async = true } end, '[l]sp [f]ormat buffer' },
|
||||||
},
|
},
|
||||||
}, { prefix = "<leader>" })
|
}, { prefix = "<leader>" }) ]]
|
||||||
if client.server_capabilities.inlayHintProvider then
|
wk.add({
|
||||||
|
{ "<leader>l", group = "[l]sp" },
|
||||||
|
{ "<leader>lR", "<cmd>vim.lsp.codelens.refresh<cr>", desc = "[l]sp code lenses [R]efresh" },
|
||||||
|
{ "<leader>ld", "<cmd>vim.lsp.buf.document_symbol<cr>", desc = "[l]sp [d]ocument symbol" },
|
||||||
|
{ "<leader>lf", function() vim.lsp.buf.format { async = true } end, desc = "[l]sp [f]ormat buffer" },
|
||||||
|
{ "<leader>lg", group = "[g]o to" },
|
||||||
|
{ "<leader>lgt", "<cmd>vim.lsp.buf.type_definition<cr>", desc = "[l]sp [g]o to [t]ype definition" },
|
||||||
|
{ "<leader>lp", group = "[p]eek" },
|
||||||
|
{ "<leader>lpd", peek_definition, desc = "[l]sp [p]eek [d]efinition" },
|
||||||
|
{ "<leader>lpt", peek_type_definition, desc = "[l]sp [p]eek [t]ype definition" },
|
||||||
|
{ "<leader>lr", "<cmd>vim.lsp.buf.rename<cr>", desc = "[l]sp [r]ename" },
|
||||||
|
{ "<leader>lw", group = "[w]orkspace" },
|
||||||
|
{ "<leader>lwa", "<cmd>vim.lsp.buf.add_workspace_folder<cr>", desc = "[l]sp add [w]orksp[a]ce folder" },
|
||||||
|
{ "<leader>lwl", function() vim.print(vim.lsp.buf.list_workspace_folders()) end, desc = "[l]sp [w]orkspace folders [l]ist" },
|
||||||
|
{ "<leader>lwq", "<cmd>vim.lsp.buf.workspace_symbol<cr>", desc = "[l]sp [w]orkspace symbol [q]" },
|
||||||
|
{ "<leader>lwr", "<cmd>vim.lsp.buf.remove_workspace_folder<cr>", desc = "[l]sp [w]orkspace folder [r]emove" },
|
||||||
|
})
|
||||||
|
if client ~= nil and client.server_capabilities.inlayHintProvider then
|
||||||
-- keymap.set('n', '<space>lh', function()
|
-- keymap.set('n', '<space>lh', function()
|
||||||
wk.register({
|
wk.add({
|
||||||
['<leader>lh'] = { function()
|
"<leader>lh",
|
||||||
|
function()
|
||||||
local current_setting = vim.lsp.inlay_hint.is_enabled(bufnr)
|
local current_setting = vim.lsp.inlay_hint.is_enabled(bufnr)
|
||||||
vim.lsp.inlay_hint.enable(bufnr, not current_setting)
|
vim.lsp.inlay_hint.enable(bufnr, not current_setting)
|
||||||
end, '[l]sp toggle inlay [h]ints' }})
|
end, desc = '[l]sp toggle inlay [h]ints'
|
||||||
|
})
|
||||||
end
|
end
|
||||||
-- TODO: InlayHint setting not working - the code below is the original one
|
-- TODO: InlayHint setting not working - the code below is the original one
|
||||||
-- if client.server_capabilities.inlayHintProvider then
|
-- if client.server_capabilities.inlayHintProvider then
|
||||||
|
|
Loading…
Reference in a new issue