feat(defaults): map "grt" to LSP type_definition #34663

backport #34642

(cherry picked from commit 5d06eade25)

Co-authored-by: Caleb White <cdwhite3@pm.me>
This commit is contained in:
Justin M. Keyes
2025-06-26 11:45:02 -07:00
committed by GitHub
parent e6eb910496
commit db3b856779
4 changed files with 9 additions and 2 deletions

View File

@ -81,12 +81,13 @@ the options are empty or were set by the builtin runtime (ftplugin) files. The
options are not restored when the LSP client is stopped or detached. options are not restored when the LSP client is stopped or detached.
GLOBAL DEFAULTS GLOBAL DEFAULTS
*grr* *gra* *grn* *gri* *i_CTRL-S* *grr* *gra* *grn* *gri* *grt* *i_CTRL-S*
These GLOBAL keymaps are created unconditionally when Nvim starts: These GLOBAL keymaps are created unconditionally when Nvim starts:
- "grn" is mapped in Normal mode to |vim.lsp.buf.rename()| - "grn" is mapped in Normal mode to |vim.lsp.buf.rename()|
- "gra" is mapped in Normal and Visual mode to |vim.lsp.buf.code_action()| - "gra" is mapped in Normal and Visual mode to |vim.lsp.buf.code_action()|
- "grr" is mapped in Normal mode to |vim.lsp.buf.references()| - "grr" is mapped in Normal mode to |vim.lsp.buf.references()|
- "gri" is mapped in Normal mode to |vim.lsp.buf.implementation()| - "gri" is mapped in Normal mode to |vim.lsp.buf.implementation()|
- "grt" is mapped in Normal mode to |vim.lsp.buf.type_definition()|
- "gO" is mapped in Normal mode to |vim.lsp.buf.document_symbol()| - "gO" is mapped in Normal mode to |vim.lsp.buf.document_symbol()|
- CTRL-S is mapped in Insert mode to |vim.lsp.buf.signature_help()| - CTRL-S is mapped in Insert mode to |vim.lsp.buf.signature_help()|

View File

@ -188,6 +188,7 @@ DEFAULTS
• |gri| in Normal mode maps to |vim.lsp.buf.implementation()| • |gri| in Normal mode maps to |vim.lsp.buf.implementation()|
• |gO| in Normal mode maps to |vim.lsp.buf.document_symbol()| • |gO| in Normal mode maps to |vim.lsp.buf.document_symbol()|
• |gra| in Normal and Visual mode maps to |vim.lsp.buf.code_action()| • |gra| in Normal and Visual mode maps to |vim.lsp.buf.code_action()|
• |grt| in Normal mode maps to |vim.lsp.buf.type_definition()|
• CTRL-S in Insert and Select mode maps to |vim.lsp.buf.signature_help()| • CTRL-S in Insert and Select mode maps to |vim.lsp.buf.signature_help()|
• Mouse |popup-menu| includes an "Open in web browser" item when you right-click • Mouse |popup-menu| includes an "Open in web browser" item when you right-click
on a URL. on a URL.

View File

@ -153,6 +153,7 @@ you never want any default mappings, call |:mapclear| early in your config.
- |grr| - |grr|
- |gra| - |gra|
- |gri| - |gri|
- |grt|
- |gO| - |gO|
- <C-S> |i_CTRL-S| - <C-S> |i_CTRL-S|
- ]d |]d-default| - ]d |]d-default|

View File

@ -191,7 +191,7 @@ do
--- client is attached. If no client is attached, or if a server does not support a capability, an --- 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. --- error message is displayed rather than exhibiting different behavior.
--- ---
--- See |grr|, |grn|, |gra|, |gri|, |gO|, |i_CTRL-S|. --- See |grr|, |grn|, |gra|, |gri|, |grt| |gO|, |i_CTRL-S|.
do do
vim.keymap.set('n', 'grn', function() vim.keymap.set('n', 'grn', function()
vim.lsp.buf.rename() vim.lsp.buf.rename()
@ -209,6 +209,10 @@ do
vim.lsp.buf.implementation() vim.lsp.buf.implementation()
end, { desc = 'vim.lsp.buf.implementation()' }) end, { desc = 'vim.lsp.buf.implementation()' })
vim.keymap.set('n', 'grt', function()
vim.lsp.buf.type_definition()
end, { desc = 'vim.lsp.buf.type_definition()' })
vim.keymap.set('n', 'gO', function() vim.keymap.set('n', 'gO', function()
vim.lsp.buf.document_symbol() vim.lsp.buf.document_symbol()
end, { desc = 'vim.lsp.buf.document_symbol()' }) end, { desc = 'vim.lsp.buf.document_symbol()' })