I thought switching from vim to neovim would be like switching from a nano+ to a VSCode CLI, but it’s far from that. There are so many plugins and it’s not as easy as declaring which plugins I want, having one dictionary/mapping/attribute set with keybindings, another with global preferences, and done.
Then there’s something about language servers. The list on https://github.com/rockerBOO/awesome-neovim is daunting. I thought LSP support was built into nvim
. Why are there so many LSP plugins? And what the hell is treesitter and why do I need it?
I copied some dude’s config and suddenly Ctrl+P
for completion didn’t work like in VIM.
There’s just so much unexplained jargon and abbreviations, that it feels like I have to read neovim code before even using it (ain’t nobody got time for that). Is neovim actually the right tool to use to have an easy CLI IDE? Is there an easier command-line alternative that just lets me go “oh, this language isn’t supported, let me open the package manager and install the $language-plugin
”, with “Goto Definition”, debugging with breakpoints, code formatting, refactoring (rename variable/method/class, extract function, etc.) ? Maybe neovim just isn’t the right tool for those without years of time.
Edit: Thanks for the suggestions everybody. Finally went with Lunarvim and it’s been a joy!
Try Helix, it’s another modal (terminal) editor, but it comes with what you’d expect from a usable text editor out of the box to work on software projects. No need to fight with a million plugins all designed independently.
Good choice, however the number of supported languages is limited to things with language server or treesitter support. Meaning languages without this, like asciidoc, is not supported and might never be
both of these things are pretty standard tbh, if a language doesn’t even have treesitter grammar, its ecosystem is probably laking
Nim, which I use as my main language, doesn’t have usable Treesitter support. Not for a lack of trying, but because its grammar is very complex and has some features that Treesitter doesn’t play well with (indentation sensitivity, style insensitivity).
Also, I do a lot of work in my own language which obviously doesn’t have any ecosystem at all.
LunarVIM
A good choice… another ist astronvim.
Astronvim covers the basic setup and their community repo with its language packs the specifics :-)
I’ll try astrovim after lunarvim. Thanks.
I installed lunarvim(.org) and it gave me all the IDE things I needed + easy installation and configuration
Some would probably consider it sacrilegious, but you can actually embed Neovim inside VS Code (or Codium, the FOSS soft fork, similar to what Chromium is for Chrome).
https://github.com/vscode-neovim/vscode-neovim
I’ve been using this for a couple years (after using vim for a few decades). You get the best of both worlds. You can use both VS Code plugins as well as Neovim/Vim extensions too — whatever you prefer.
I still use Neovim on the command line for quick edits, but I’m happy with VS Codium + Neovim for long IDE coding sessions.
I had similar troubles and my neovim config was not where I wanted it to be. But then I tried AstroNvim and it was great out of the box. From there I customized it to my liking. Also great documentation and fast support from the developers.
I’ve been curious about neovim too, I’m planning on biting off too much with this little walkthrough:
https://vonheikemen.github.io/devlog/tools/build-your-first-lua-config-for-neovim/
I’ll pile on to the lunarvim suggestions for a more out of the box/curated experience.
It takes a while to create your minimal and perfect experience, so if you don’t have the time for that I’d suggest using a ready to go neovim setup. Others have suggests kickstart and lunavim. I’d suggest LazyVim since it uses lazy.nvim which is an async package manager. https://www.lazyvim.org/
You’re propably better of not worrying too much about the awesome-neovim list until you’re more familiar with nvim itself
I thought LSP support was built into nvim. Why are there so many LSP plugins?
Most of the plugins seem to be adding bells and whistles to the core LSP functionality and can be safely ignored. The main one that I recomment is nvim-lspconfig which makes it easier to get servers up and running. Neovim itself knows the lsp protocol but isn’t aware of any particular lsp servers. lspconfig comes with premade configurations for different servers so that you don’t have to e.g. tell neovim where to look for the executable or which servers handle which filetypes and so on. It is doable to use LSP without this plugin as well, it just means more boilerplate in your config file.
And what the hell is treesitter and why do I need it?
Treesitter is a different way of parsing files for e.g. syntax highlighting. Vanilla (neo)vim uses a pile of regular expressions to perform syntax highlighting essentially, while treesitter actually parses the source files in a way that is aware of the way the target language works. Treesitter might know the difference between a macro and a function for example, and can highlight them differently. You can also querry the syntax tree that tressitter has parsed for use in custom scripts or plugins. Also completely optional unless you want to use a plugin that depends on it.
As for plugin manegement, I use vim-plugged (which is a vim plugin but is also compatible with neovim). You basically just list the github/gitlab repos you want in your .vimrc file and run a command to download/update them.
My lsp code in my init.vim file is as follows (taking advantage of nvim-lspconfig): https://pastebin.com/0Wy1ASwk. Adding a new lsp means making sure that the server itself is intalled (e.g. through my package manager) and then adding another line in the langs object, like when i added erlangls i just added
erlangls = {},
on line 19.(EDIT: For some reason the
nmap('gd', vim.lsp.buf.definition)
line is repeated a bunch of times in the paste bin. That’s not on purpose)Debugging is imo a weak point for both vim and neovim, there’s nvim-dap and vimspector which takes advantage of LSPs sister protocol DAP (debug adapter protocol). Setting it up is principaly similar to LSPs. Vim and neovim also have the builtin termdebug plugin which you can load using
packadd termdebug
in you .vimrc file and allows you to debug using GDB.This here is also a good starting point for Neovim: https://github.com/nvim-lua/kickstart.nvim
I recommend to start with kickstart if you prefer to customize https://github.com/nvim-lua/kickstart.nvim or Lunarvim for a full IDE experience to see what’s possible and go from there https://www.lunarvim.org/de/
Most works out of the box then. Start there and customize further to your needs