From 61063653b06bfccac083c0105ecd0c433b3bb8f7 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 28 Apr 2024 09:02:18 -0700 Subject: 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 --- runtime/lua/vim/_defaults.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/_defaults.lua') diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index 7166f7a23c..1094f22793 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -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', 'r') + map_codeaction('x', '') vim.keymap.set('n', 'gr', function() vim.lsp.buf.references() -- cgit