mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
revert: default LSP mappings (#28649)
Revert the default LSP mappings before the 0.10 release as these might need some further consideration. In particular, it's not clear if "c" prefixed maps in Normal mode are acceptable as defaults since they interfere with text objects or operator ranges. We will re-introduce default mappings at the beginning of the 0.11 release cycle, this reversion is only for the imminent 0.10 release.
This commit is contained in:
parent
783c1e596c
commit
bb032d952b
@ -61,18 +61,6 @@ options are not restored when the LSP client is stopped or detached.
|
|||||||
- |K| is mapped to |vim.lsp.buf.hover()| unless |'keywordprg'| is customized or
|
- |K| is mapped to |vim.lsp.buf.hover()| unless |'keywordprg'| is customized or
|
||||||
a custom keymap for `K` exists.
|
a custom keymap for `K` exists.
|
||||||
|
|
||||||
*crr* *crn* *i_CTRL-S* *v_CTRL-R_CTRL-R* *v_CTRL-R_r*
|
|
||||||
Some keymaps are created unconditionally when Nvim starts:
|
|
||||||
- "crn" is mapped in Normal mode to |vim.lsp.buf.rename()|
|
|
||||||
- "crr" is mapped in Normal mode to |vim.lsp.buf.code_action()|
|
|
||||||
- CTRL-R CTRL-R (also "CTRL-R r") is mapped in Visual mode to
|
|
||||||
|vim.lsp.buf.code_action()|
|
|
||||||
- "gr" is mapped in Normal mode to |vim.lsp.buf.references()| |gr-default|
|
|
||||||
- CTRL-S is mapped in Insert mode to |vim.lsp.buf.signature_help()|
|
|
||||||
|
|
||||||
If not wanted, these keymaps can be removed at any time using
|
|
||||||
|vim.keymap.del()| or |:unmap|.
|
|
||||||
|
|
||||||
*lsp-defaults-disable*
|
*lsp-defaults-disable*
|
||||||
To override the above defaults, set or unset the options on |LspAttach|: >lua
|
To override the above defaults, set or unset the options on |LspAttach|: >lua
|
||||||
|
|
||||||
@ -92,8 +80,11 @@ Example: >lua
|
|||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
if client.supports_method('textDocument/rename') then
|
||||||
|
-- Create a keymap for vim.lsp.buf.rename()
|
||||||
|
end
|
||||||
if client.supports_method('textDocument/implementation') then
|
if client.supports_method('textDocument/implementation') then
|
||||||
vim.keymap.set('n', 'g<C-I>', vim.lsp.buf.implementation, { buffer = args.buf })
|
-- Create a keymap for vim.lsp.buf.implementation
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -418,12 +418,6 @@ The following changes to existing APIs or features add new behavior.
|
|||||||
• 'shortmess' includes the "C" flag.
|
• 'shortmess' includes the "C" flag.
|
||||||
• 'grepprg' uses the -H and -I flags for grep by default,
|
• 'grepprg' uses the -H and -I flags for grep by default,
|
||||||
and defaults to using ripgrep if available.
|
and defaults to using ripgrep if available.
|
||||||
• |crn| in Normal mode maps to |vim.lsp.buf.rename()|.
|
|
||||||
• |crr| in Normal mode maps to |vim.lsp.buf.code_action()|.
|
|
||||||
• |v_CTRL-R_CTRL-R| in Visual mode maps to |vim.lsp.buf.code_action()|.
|
|
||||||
• "gr" in Normal mode maps to |vim.lsp.buf.references()| |gr-default|
|
|
||||||
• |i_CTRL-S| in Insert mode maps to |vim.lsp.buf.signature_help()|
|
|
||||||
• "]d" and "[d" in Normal mode map to |vim.diagnostic.goto_next()| and
|
|
||||||
|vim.diagnostic.goto_prev()|, respectively. |]d-default| |[d-default|
|
|vim.diagnostic.goto_prev()|, respectively. |]d-default| |[d-default|
|
||||||
• <C-W>d (and <C-W><C-D>) map to |vim.diagnostic.open_float()|
|
• <C-W>d (and <C-W><C-D>) map to |vim.diagnostic.open_float()|
|
||||||
|CTRL-W_d-default|
|
|CTRL-W_d-default|
|
||||||
|
@ -138,12 +138,6 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y".
|
|||||||
- * |v_star-default|
|
- * |v_star-default|
|
||||||
- gc |gc-default| |v_gc-default| |o_gc-default|
|
- gc |gc-default| |v_gc-default| |o_gc-default|
|
||||||
- gcc |gcc-default|
|
- gcc |gcc-default|
|
||||||
- |crn|
|
|
||||||
- |crr|
|
|
||||||
- <C-R><C-R> |v_CTRL-R_CTRL-R|
|
|
||||||
- <C-R>r |v_CTRL-R_r|
|
|
||||||
- gr |gr-default|
|
|
||||||
- <C-S> |i_CTRL-S|
|
|
||||||
- ]d |]d-default|
|
- ]d |]d-default|
|
||||||
- [d |[d-default|
|
- [d |[d-default|
|
||||||
- <C-W>d |CTRL-W_d-default|
|
- <C-W>d |CTRL-W_d-default|
|
||||||
|
@ -146,36 +146,6 @@ do
|
|||||||
vim.keymap.set({ 'o' }, 'gc', textobject_rhs, { desc = 'Comment textobject' })
|
vim.keymap.set({ 'o' }, 'gc', textobject_rhs, { desc = 'Comment textobject' })
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Default maps for LSP functions.
|
|
||||||
---
|
|
||||||
--- These are mapped unconditionally to avoid confusion. If no server is attached, or if a server
|
|
||||||
--- does not support a capability, an error message is displayed rather than exhibiting different
|
|
||||||
--- behavior.
|
|
||||||
---
|
|
||||||
--- See |gr-default|, |crn|, |crr|, |i_CTRL-S|.
|
|
||||||
do
|
|
||||||
vim.keymap.set('n', 'crn', function()
|
|
||||||
vim.lsp.buf.rename()
|
|
||||||
end, { desc = 'vim.lsp.buf.rename()' })
|
|
||||||
|
|
||||||
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()
|
|
||||||
end, { desc = 'vim.lsp.buf.references()' })
|
|
||||||
|
|
||||||
vim.keymap.set('i', '<C-S>', function()
|
|
||||||
vim.lsp.buf.signature_help()
|
|
||||||
end, { desc = 'vim.lsp.buf.signature_help()' })
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Map [d and ]d to move to the previous/next diagnostic. Map <C-W>d to open a floating window
|
--- Map [d and ]d to move to the previous/next diagnostic. Map <C-W>d to open a floating window
|
||||||
--- for the diagnostic under the cursor.
|
--- for the diagnostic under the cursor.
|
||||||
---
|
---
|
||||||
|
Loading…
Reference in New Issue
Block a user