aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_defaults.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-05-24 11:33:49 -0500
committerGitHub <noreply@github.com>2024-05-24 11:33:49 -0500
commit2c6b6358722b2df9160c3739b0cea07e8779513f (patch)
tree017a917df879890f441e7fabc00db1fc94339ae9 /runtime/lua/vim/_defaults.lua
parent206f8f24a2470f961cfe7e7c177443c0f199231c (diff)
downloadrneovim-2c6b6358722b2df9160c3739b0cea07e8779513f.tar.gz
rneovim-2c6b6358722b2df9160c3739b0cea07e8779513f.tar.bz2
rneovim-2c6b6358722b2df9160c3739b0cea07e8779513f.zip
feat(defaults): add LSP default mappings (again) (#28650)
Diffstat (limited to 'runtime/lua/vim/_defaults.lua')
-rw-r--r--runtime/lua/vim/_defaults.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 7015d376ae..5b964b84a0 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -149,6 +149,31 @@ do
vim.keymap.set({ 'o' }, 'gc', textobject_rhs, { desc = 'Comment textobject' })
end
+ --- Default maps for LSP functions.
+ ---
+ --- These are mapped unconditionally to avoid different behavior depending on whether an LSP
+ --- client is attached. If no client is attached, or if a server does not support a capability, an
+ --- error message is displayed rather than exhibiting different behavior.
+ ---
+ --- See |grr|, |grn|, |gra|, |i_CTRL-S|.
+ do
+ vim.keymap.set('n', 'grn', function()
+ vim.lsp.buf.rename()
+ end, { desc = 'vim.lsp.buf.rename()' })
+
+ vim.keymap.set({ 'n', 'x' }, 'gra', function()
+ vim.lsp.buf.code_action()
+ end, { desc = 'vim.lsp.buf.code_action()' })
+
+ vim.keymap.set('n', 'grr', 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
--- for the diagnostic under the cursor.
---