Skip to content

Commit 6ca6d16

Browse files
committed
refactor: change LSP keybindings to the default gr bindings introduced in 0.11
1 parent e947649 commit 6ca6d16

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

init.lua

+18-21
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,6 @@ require('lazy').setup({
336336

337337
-- Document existing key chains
338338
spec = {
339-
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
340-
{ '<leader>d', group = '[D]ocument' },
341-
{ '<leader>r', group = '[R]ename' },
342339
{ '<leader>s', group = '[S]earch' },
343340
{ '<leader>w', group = '[W]orkspace' },
344341
{ '<leader>t', group = '[T]oggle' },
@@ -532,39 +529,39 @@ require('lazy').setup({
532529
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
533530
end
534531

535-
-- Jump to the definition of the word under your cursor.
536-
-- This is where a variable was first declared, or where a function is defined, etc.
537-
-- To jump back, press <C-t>.
538-
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
532+
-- Rename the variable under your cursor.
533+
-- Most Language Servers support renaming across files, etc.
534+
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
535+
536+
-- Execute a code action, usually your cursor needs to be on top of an error
537+
-- or a suggestion from your LSP for this to activate.
538+
map('gca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
539539

540540
-- Find references for the word under your cursor.
541-
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
541+
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
542542

543543
-- Jump to the implementation of the word under your cursor.
544544
-- Useful when your language has ways of declaring types without an actual implementation.
545-
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
545+
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
546+
547+
-- Fuzzy find all the symbols in your current document.
548+
-- Symbols are things like variables, functions, types, etc.
549+
map('gO', require('telescope.builtin').lsp_document_symbols, '[O]pen Document Symbols')
550+
551+
-- Jump to the definition of the word under your cursor.
552+
-- This is where a variable was first declared, or where a function is defined, etc.
553+
-- To jump back, press <C-t>.
554+
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
546555

547556
-- Jump to the type of the word under your cursor.
548557
-- Useful when you're not sure what type a variable is and you want to see
549558
-- the definition of its *type*, not where it was *defined*.
550559
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
551560

552-
-- Fuzzy find all the symbols in your current document.
553-
-- Symbols are things like variables, functions, types, etc.
554-
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
555-
556561
-- Fuzzy find all the symbols in your current workspace.
557562
-- Similar to document symbols, except searches over your entire project.
558563
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
559564

560-
-- Rename the variable under your cursor.
561-
-- Most Language Servers support renaming across files, etc.
562-
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
563-
564-
-- Execute a code action, usually your cursor needs to be on top of an error
565-
-- or a suggestion from your LSP for this to activate.
566-
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
567-
568565
-- WARN: This is not Goto Definition, this is Goto Declaration.
569566
-- For example, in C this would take you to the header.
570567
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')

0 commit comments

Comments
 (0)