Notes on Neovim Builtin LSP Setup Guide - bdatko/nvim GitHub Wiki

Capturing some notes below. All the stuff is a mixture of stuff

  • Plugin commands are always capital this is inferred from VimScripts / VimL

I think some of these notes below are from YouTube - Neovim Builtin LSP Setup Guide from TJ Devries uploaded Jan 27, 2022.

  • vimlsp
  • vim.lsp.start
  • :h autocmd callbacks
  • :h events
  • vim.api.create_autocmd
  • vim.lsp.buf.hover()
  • vim.lsp.buf.definition()
  • :LspInfo
  • lazy dependencies

Other Things I want to look up...

  • vim.opt vs vim.opt_local
  • searching options --> use the :options commands
  • vim.notify?
  • :messages or :mess

Some other notes

  • not inside a buffer with an lsp attached
  • good to only override key maps only within the function on_lsp_attach so when you don't have an lsp you are back to "normal vim mapping" idomatic key bindings
  • require('lspconfig').<name-of-ls>.setup
  • :LspStart and :LspInfo but this older nvim

Some mappings from YouTube - Neovim Builtin LSP Setup Guide from TJ Devries. All this is older so be careful.

  • :nmap given an argument shows mappings
  • vim.lsp.buf.code_action
  • vim.lsp.buf.rename
  • vim.lsp.buf.implementation
  • vim.lsp.buf.type_definition
  • vim.lsp.buf.hover map to K (idomatic key bindings)
  • vim.lsp.buf.definition map to gD for example

The above APIs you can always run yourself in Lua using :lua

Other key maps they mentioned

  • K
  • gT
  • gd
  • gI
  • <Leader>dp
  • <Leader>dh

gD then <C-t> tag stack

  • spirt of lsp builtin if there is some vim idiom we use the vimism
  • jump to definition adds it to the tag stack
  • tag list different from the jump list

Should look up help jumplist and help taglist

  • Patterns to keep an eye on when reading the docs and working with your own lsp config is to notice "hey I found this cool function I will just add it to my 'on_attach'"
  • vim.diagnostic.goto_next -> Telescope diagnostic -> <C-q> quick fix
  • code_actions are specific to the lsp server
  • LspInfo -> start, check for problems. I think you should prefer :checkhealth instead though
⚠️ **GitHub.com Fallback** ⚠️