Setting up Go to definition? #205
-
Hi! I can't really understand how I am supposed to use the go to definition functionality. Using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey, if you want to map opts = { noremap = true, silent = true, buffer = bufnr } -- bufnr is an argument of the on_attach function
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) I don't include all LSP-related keymaps in the readme, because there are already a bunch of suggestions in the nvim-lspconfig readme (which I link to). For go-to-definition specifically, neovim automatically sets up a |
Beta Was this translation helpful? Give feedback.
Hey,
if you want to map
gd
to go-to-definition, you can add a keymap:I don't include all LSP-related keymaps in the readme, because there are already a bunch of suggestions in the nvim-lspconfig readme (which I link to).
For go-to-definition specifically, neovim automatically sets up a
tagfunc
, so you can useC-[
to jump to a definition, and fall back to tags if the definition can't be found. This is useful if you also use something like fast-tags.