@@ -316,7 +316,7 @@ require('lazy').setup({
316
316
317
317
-- Document existing key chains
318
318
require (' which-key' ).add {
319
- { ' <leader>c' , group = ' [C]ode' },
319
+ { ' <leader>c' , group = ' [C]ode' , mode = { ' n ' , ' x ' } },
320
320
{ ' <leader>d' , group = ' [D]ocument' },
321
321
{ ' <leader>r' , group = ' [R]ename' },
322
322
{ ' <leader>s' , group = ' [S]earch' },
@@ -507,8 +507,9 @@ require('lazy').setup({
507
507
--
508
508
-- In this case, we create a function that lets us more easily define mappings specific
509
509
-- for LSP related items. It sets the mode, buffer and description for us each time.
510
- local map = function (keys , func , desc )
511
- vim .keymap .set (' n' , keys , func , { buffer = event .buf , desc = ' LSP: ' .. desc })
510
+ local map = function (keys , func , desc , mode )
511
+ mode = mode or ' n'
512
+ vim .keymap .set (mode , keys , func , { buffer = event .buf , desc = ' LSP: ' .. desc })
512
513
end
513
514
514
515
-- Jump to the definition of the word under your cursor.
@@ -542,7 +543,7 @@ require('lazy').setup({
542
543
543
544
-- Execute a code action, usually your cursor needs to be on top of an error
544
545
-- or a suggestion from your LSP for this to activate.
545
- map (' <leader>ca' , vim .lsp .buf .code_action , ' [C]ode [A]ction' )
546
+ map (' <leader>ca' , vim .lsp .buf .code_action , ' [C]ode [A]ction' , { ' n ' , ' x ' } )
546
547
547
548
-- WARN: This is not Goto Definition, this is Goto Declaration.
548
549
-- For example, in C this would take you to the header.
0 commit comments