Skip to content

Commit 81b7ad4

Browse files
committed
Revert "Change LSP Keybindings to Match the Default gr Bindings Introduced in Neovim 0.11 (nvim-lua#1427)"
This reverts commit 1a5787b. I'm not in the mood to learn new keybindings right now. Will do it in my own time.
1 parent d350db2 commit 81b7ad4

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

init.lua

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,11 @@ 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' },
339342
{ '<leader>s', group = '[S]earch' },
343+
{ '<leader>w', group = '[W]orkspace' },
340344
{ '<leader>t', group = '[T]oggle' },
341345
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
342346
},
@@ -527,42 +531,42 @@ require('lazy').setup({
527531
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
528532
end
529533

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

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

541542
-- Jump to the implementation of the word under your cursor.
542543
-- Useful when your language has ways of declaring types without an actual implementation.
543-
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
544+
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
544545

545-
-- Jump to the definition of the word under your cursor.
546-
-- This is where a variable was first declared, or where a function is defined, etc.
547-
-- To jump back, press <C-t>.
548-
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
549-
550-
-- WARN: This is not Goto Definition, this is Goto Declaration.
551-
-- For example, in C this would take you to the header.
552-
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
546+
-- Jump to the type of the word under your cursor.
547+
-- Useful when you're not sure what type a variable is and you want to see
548+
-- the definition of its *type*, not where it was *defined*.
549+
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
553550

554551
-- Fuzzy find all the symbols in your current document.
555552
-- Symbols are things like variables, functions, types, etc.
556-
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
553+
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
557554

558555
-- Fuzzy find all the symbols in your current workspace.
559556
-- Similar to document symbols, except searches over your entire project.
560-
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
557+
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
561558

562-
-- Jump to the type of the word under your cursor.
563-
-- Useful when you're not sure what type a variable is and you want to see
564-
-- the definition of its *type*, not where it was *defined*.
565-
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
559+
-- Rename the variable under your cursor.
560+
-- Most Language Servers support renaming across files, etc.
561+
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
562+
563+
-- Execute a code action, usually your cursor needs to be on top of an error
564+
-- or a suggestion from your LSP for this to activate.
565+
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
566+
567+
-- WARN: This is not Goto Definition, this is Goto Declaration.
568+
-- For example, in C this would take you to the header.
569+
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
566570

567571
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
568572
---@param client vim.lsp.Client

0 commit comments

Comments
 (0)