feat(defaults): visual CTRL-R for LSP mappings #28537

Problem:
The new LSP "refactor menu" keybinding "crr" is also defined in visual
mode, which overlaps with the builtin "c".

Solution:
Use CTRL-R instead of "crr" for visual mode.

fix #28528
This commit is contained in:
Justin M. Keyes
2024-04-28 09:02:18 -07:00
committed by GitHub
parent 513fc46195
commit 61063653b0
6 changed files with 18 additions and 8 deletions

View File

@@ -159,9 +159,14 @@ do
vim.lsp.buf.rename()
end, { desc = 'vim.lsp.buf.rename()' })
vim.keymap.set({ 'n', 'v' }, 'crr', function()
vim.lsp.buf.code_action()
end, { desc = 'vim.lsp.buf.code_action()' })
local function map_codeaction(mode, lhs)
vim.keymap.set(mode, lhs, function()
vim.lsp.buf.code_action()
end, { desc = 'vim.lsp.buf.code_action()' })
end
map_codeaction('n', 'crr')
map_codeaction('x', '<C-R>r')
map_codeaction('x', '<C-R><C-R>')
vim.keymap.set('n', 'gr', function()
vim.lsp.buf.references()