@@ -383,11 +383,7 @@ require('lazy').setup({
383
383
384
384
-- Document existing key chains
385
385
spec = {
386
- { ' <leader>c' , group = ' [C]ode' , mode = { ' n' , ' x' } },
387
- { ' <leader>d' , group = ' [D]ocument' },
388
- { ' <leader>r' , group = ' [R]ename' },
389
386
{ ' <leader>s' , group = ' [S]earch' },
390
- { ' <leader>w' , group = ' [W]orkspace' },
391
387
{ ' <leader>t' , group = ' [T]oggle' },
392
388
{ ' <leader>h' , group = ' Git [H]unk' , mode = { ' n' , ' v' } },
393
389
},
@@ -580,17 +576,37 @@ require('lazy').setup({
580
576
vim .keymap .set (mode , keys , func , { buffer = event .buf , desc = ' LSP: ' .. desc })
581
577
end
582
578
583
- -- Jump to the definition of the word under your cursor.
584
- -- This is where a variable was first declared, or where a function is defined, etc.
585
- -- To jump back, press <C-t>.
586
- map (' gd' , require (' telescope.builtin' ).lsp_definitions , ' [G]oto [D]efinition' )
579
+ -- Rename the variable under your cursor.
580
+ -- Most Language Servers support renaming across files, etc.
581
+ map (' grn' , vim .lsp .buf .rename , ' [R]e[n]ame' )
582
+
583
+ -- Execute a code action, usually your cursor needs to be on top of an error
584
+ -- or a suggestion from your LSP for this to activate.
585
+ map (' gra' , vim .lsp .buf .code_action , ' [G]oto Code [A]ction' , { ' n' , ' x' })
587
586
588
587
-- Find references for the word under your cursor.
589
- map (' gr ' , require (' telescope.builtin' ).lsp_references , ' [G]oto [R]eferences' )
588
+ map (' grr ' , require (' telescope.builtin' ).lsp_references , ' [G]oto [R]eferences' )
590
589
591
590
-- Jump to the implementation of the word under your cursor.
592
591
-- Useful when your language has ways of declaring types without an actual implementation.
593
- map (' gI' , require (' telescope.builtin' ).lsp_implementations , ' [G]oto [I]mplementation' )
592
+ map (' gri' , require (' telescope.builtin' ).lsp_implementations , ' [G]oto [I]mplementation' )
593
+
594
+ -- Jump to the definition of the word under your cursor.
595
+ -- This is where a variable was first declared, or where a function is defined, etc.
596
+ -- To jump back, press <C-t>.
597
+ map (' grd' , require (' telescope.builtin' ).lsp_definitions , ' [G]oto [D]efinition' )
598
+
599
+ -- WARN: This is not Goto Definition, this is Goto Declaration.
600
+ -- For example, in C this would take you to the header.
601
+ map (' grD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
602
+
603
+ -- Fuzzy find all the symbols in your current document.
604
+ -- Symbols are things like variables, functions, types, etc.
605
+ map (' gO' , require (' telescope.builtin' ).lsp_document_symbols , ' Open Document Symbols' )
606
+
607
+ -- Fuzzy find all the symbols in your current workspace.
608
+ -- Similar to document symbols, except searches over your entire project.
609
+ map (' gW' , require (' telescope.builtin' ).lsp_dynamic_workspace_symbols , ' Open Workspace Symbols' )
594
610
595
611
-- Jump to the type of the word under your cursor.
596
612
-- Useful when you're not sure what type a variable is and you want to see
0 commit comments