mirror of
https://github.com/neovim/neovim.git
synced 2026-04-01 05:12:02 +00:00
feat(defaults): map "grx" to vim.lsp.codelens.run() #37689
Problem Unlike inlay hints, code lenses are closely related to running commands; a significant number of code lenses are used to execute a command (such as running tests). Therefore, it is necessary to provide a default mapping for them. Solution Add a new default mapping "grx" (mnemonic: "eXecute", like "gx").
This commit is contained in:
@@ -74,7 +74,7 @@ functionality and (2) the options are empty or were set by the builtin runtime
|
|||||||
(ftplugin) files. The options are not restored when the LSP client is stopped
|
(ftplugin) files. The options are not restored when the LSP client is stopped
|
||||||
or detached.
|
or detached.
|
||||||
|
|
||||||
GLOBAL DEFAULTS *gra* *gri* *grn* *grr* *grt* *i_CTRL-S*
|
GLOBAL DEFAULTS *gra* *gri* *grn* *grr* *grt* *grx* *i_CTRL-S*
|
||||||
|
|
||||||
These GLOBAL keymaps are created unconditionally when Nvim starts:
|
These GLOBAL keymaps are created unconditionally when Nvim starts:
|
||||||
|
|
||||||
@@ -83,6 +83,7 @@ These GLOBAL keymaps are created unconditionally when Nvim starts:
|
|||||||
- "grn" is mapped to |vim.lsp.buf.rename()|
|
- "grn" is mapped to |vim.lsp.buf.rename()|
|
||||||
- "grr" is mapped to |vim.lsp.buf.references()|
|
- "grr" is mapped to |vim.lsp.buf.references()|
|
||||||
- "grt" is mapped to |vim.lsp.buf.type_definition()|
|
- "grt" is mapped to |vim.lsp.buf.type_definition()|
|
||||||
|
- "grx" is mapped to |vim.lsp.codelens.run()|
|
||||||
- "gO" is mapped to |vim.lsp.buf.document_symbol()|
|
- "gO" is mapped to |vim.lsp.buf.document_symbol()|
|
||||||
- CTRL-S (Insert mode) is mapped to |vim.lsp.buf.signature_help()|
|
- CTRL-S (Insert mode) is mapped to |vim.lsp.buf.signature_help()|
|
||||||
- |v_an| and |v_in| fall back to LSP |vim.lsp.buf.selection_range()| if
|
- |v_an| and |v_in| fall back to LSP |vim.lsp.buf.selection_range()| if
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ DEFAULTS
|
|||||||
Unset 'exrc' to stop further search.
|
Unset 'exrc' to stop further search.
|
||||||
• Mappings:
|
• Mappings:
|
||||||
• |grt| in Normal mode maps to |vim.lsp.buf.type_definition()|
|
• |grt| in Normal mode maps to |vim.lsp.buf.type_definition()|
|
||||||
|
• |grx| in Normal mode maps to |vim.lsp.codelens.run()|
|
||||||
• 'shada' default now excludes "/tmp/" and "/private/" paths to reduce clutter in |:oldfiles|.
|
• 'shada' default now excludes "/tmp/" and "/private/" paths to reduce clutter in |:oldfiles|.
|
||||||
• Enabled treesitter highlighting for Markdown files
|
• Enabled treesitter highlighting for Markdown files
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,10 @@ do
|
|||||||
vim.lsp.buf.code_action()
|
vim.lsp.buf.code_action()
|
||||||
end, { desc = 'vim.lsp.buf.code_action()' })
|
end, { desc = 'vim.lsp.buf.code_action()' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'grx', function()
|
||||||
|
vim.lsp.codelens.run()
|
||||||
|
end, { desc = 'vim.lsp.codelens.run()' })
|
||||||
|
|
||||||
vim.keymap.set('n', 'grr', function()
|
vim.keymap.set('n', 'grr', function()
|
||||||
vim.lsp.buf.references()
|
vim.lsp.buf.references()
|
||||||
end, { desc = 'vim.lsp.buf.references()' })
|
end, { desc = 'vim.lsp.buf.references()' })
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ describe(':help', function()
|
|||||||
|
|
||||||
n.command(':help lsp')
|
n.command(':help lsp')
|
||||||
n.feed('gg/codelens.run()|<cr>')
|
n.feed('gg/codelens.run()|<cr>')
|
||||||
eq({ '|vim.lsp.codelens.run()|.', 'lsp.txt' }, buf_word())
|
eq({ '|vim.lsp.codelens.run()|', 'lsp.txt' }, buf_word())
|
||||||
-- ^ cursor on "codelens"
|
-- ^ cursor on "codelens"
|
||||||
n.command(':help!')
|
n.command(':help!')
|
||||||
eq({ '*vim.lsp.codelens.run()*', 'lsp.txt' }, buf_word())
|
eq({ '*vim.lsp.codelens.run()*', 'lsp.txt' }, buf_word())
|
||||||
|
|||||||
Reference in New Issue
Block a user