Skip to content

Commit 9e473cb

Browse files
committed
merge nvim-lua#7
1 parent 4458bee commit 9e473cb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

init.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,9 @@ require('lazy').setup({
456456
--
457457
-- In this case, we create a function that lets us more easily define mappings specific
458458
-- for LSP related items. It sets the mode, buffer and description for us each time.
459-
local map = function(keys, func, desc)
460-
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
459+
local map = function(keys, func, desc, mode)
460+
mode = mode or 'n'
461+
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
461462
end
462463

463464
-- Jump to the definition of the word under your cursor.
@@ -491,7 +492,7 @@ require('lazy').setup({
491492

492493
-- Execute a code action, usually your cursor needs to be on top of an error
493494
-- or a suggestion from your LSP for this to activate.
494-
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
495+
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
495496

496497
-- WARN: This is not Goto Definition, this is Goto Declaration.
497498
-- For example, in C this would take you to the header.

0 commit comments

Comments
 (0)