Skip to content

Commit 0692979

Browse files
committed
Merge 'upstream' Include visual mode in LSP code action keymap
2 parents e921346 + d452633 commit 0692979

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

lua/kickstart/plugins/lspconfig.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ return {
6767
--
6868
-- In this case, we create a function that lets us more easily define mappings specific
6969
-- for LSP related items. It sets the mode, buffer and description for us each time.
70-
local map = function(keys, func, desc)
71-
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
70+
local map = function(keys, func, desc, mode)
71+
mode = mode or 'n'
72+
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
7273
end
7374

7475
-- Jump to the definition of the word under your cursor.
@@ -102,7 +103,7 @@ return {
102103

103104
-- Execute a code action, usually your cursor needs to be on top of an error
104105
-- or a suggestion from your LSP for this to activate.
105-
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
106+
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
106107

107108
-- WARN: This is not Goto Definition, this is Goto Declaration.
108109
-- For example, in C this would take you to the header.

lua/kickstart/plugins/which-key.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ return {
5959

6060
-- Document existing key chains
6161
require('which-key').add {
62-
{ '<leader>c', group = '[C]ode' },
62+
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
6363
{ '<leader>d', group = '[D]ocument' },
6464
{ '<leader>r', group = '[R]ename' },
6565
{ '<leader>s', group = '[S]earch' },

0 commit comments

Comments
 (0)