Thought I'd provide a few more details in case anyone else fancies taking the plunge into neovim / lua-only config / declaring vim-bankruptcy on their current config and starting from scratch.
My key objectives were:
- keepings some, but not necessarily all, of my vim settings + custom keymaps
- LSP features, specifically
- autocompletion
- jump-to-definition
- and any other well-supported LSP features that work ok for Python
- linting (including support for non-LSP-based linters)
- fuzzy file finder.
I was inspired by this Primagean video called Zero to LSP from scratch in which he sets up a new lua/neovim config from scratch in about 20 minutes. This was my second go at setting up nvim, so i did start with some background
People seem to keep their neovim config in lots of different files but that freaked me out. I decided to go with a single file. The challenge there is that some bits of config are time or context dependent, particularly if you're using lazy.nvim as your package manager - you only want to set certain options if a particular plugin has (a) loaded and (b) been activated. I decided to go for a very javascriptey "nested callbacks" sort of approach, which is kinda ugly but at leat everything is in one file and all the dependencies are explicit.
I used lazy.nvim as my plugin manager because one of the tutorials suggested it was what the cool kids are using and I want to be cool. Something-something lazy-loading apparently?
-
The main one is lsp-zero which is a wrapper around several LSP plugins. It includes a thing called Mason, which auto-installs and configures language servers on demand, and another library called cmp that does autocompletion.
- --> That gave me autocompletion, jump-to-definition, and several linters/diagnostics out of the box
- and now whenever I open a new file type I have the option of downloading LSPs for it, from a list of suggested ones.
-
I had to add some custom configuration for a generic LSP-based linter-wrapper called efm-langserver which essentially lets you run "normal" linters but using an LSP interface to them.