First Look at Neovim


tags: Vim

The Short Version

See my notes on getting Neovim working under Debian and Ubuntu. Neovim is a massive code clean-up and feature improvement on the Vim code base - something that was desperately needed (extensively articulated by Geoff Greer but which Bram Moolenaar seemed unwilling to undertake). Neovim is only at v0.1.5, but seems entirely compatible with Vim. To my amazement, it appears that many of Neovim's changes may be absorbed back into mainstream Vim (coming in version 8?). This is fantastic, as my first look at Neovim has already got me hugely enthusiastic. Async: awesome. Improved tab-completion: desperately needed. Built-in terminal: damn right. Better colour support: we needed that 15 years ago. And the list goes on.

Your biggest problem if you jump early is your config files: if you have problems, just keep reading - I hope this will help. For the dedicated, I have more notes about Neovim further down. Also, read this: Differences between Nvim and Vim.

Where are My Config Files?

Short answer: probably ~/.config/nvim/. But their inaccurate documentation may mislead you, and your OS may have a say in it too - so read on if that doesn't work.

Neovim does NOT use ~/.vimrc and ~/.vim/. Their documentation explains that ~/.vimrc becomes $XDG_CONFIG_HOME/nvim/init.vim and the ~/.vim/ folder becomes $XDG_CONFIG_HOME/nvim/, which led me to find the XDG Base Directory Specification which says that if $XDG_CONFIG_HOME is "either not set or empty" (as it is on my Ubuntu 14.04 system) it should default to $HOME/.local/share. Going to $HOME/.local/share/, I found there was already a nvim directory containing swap/ and shada/ folders, which suggested I was in the right place - but a good deal of mucking about with configs there proved conclusively that Neovim was NOT reading them. Further searching online - well outside of Neovim's documentation, which isn't a good thing - pointed me to ~/.config/nvim/. That directory ALSO already existed, and putting configs there got an immediate response.

UPDATE 2016-09-18: In practical terms, what this meant is that I did this: cd ~/.config ; ln -s ~/.vim nvim . My Vim config is in a repo, and as I write this update I've been using it across both editors and two OSes (Linux and Mac) for five months with zero compatibility problems. Highly recommended.

Miscellaneous Other Observations

  • the status bar is on by default, but can be turned off with :set laststatus=0 (and back on again with :set laststatus=2) ... not earthshaking, but Vim's default is for it to be off
  • tab completion behaves almost the same ... but has been extended and is much nicer because completions appear in the status bar, giving you a sign of how many completions you're going to have to cycle through (I consider this huge: Vim's tab completion is a massive PITA, and while this doesn't entirely fix it, it retains the old behaviour while giving you immensely better visibility, and arrow keys) (Better tab completion!)
  • :terminal gets you a better terminal in your window or tab than the "Conqueterm" plugin ever managed ... good enough that the Neovim webpage links to a video with emacs running inside the Neovim terminal
  • you can even run (old) Vim inside a Neovim terminal (although it complains a little)
  • Neovim supports Python plugins - this is HUGE, as previous to this all plugins had to be written in Vimscript (still supported) which is an exceptionally ugly language
  • :split and :vsplit are working, as are the split navigation commands Ctrl-W-[hjkl]
  • the :tab drop ... command is automatically available because Neovim is compiled with all options by default: with Vim this required you to install all the Vim GUI packages to make it work ... even in the terminal (made no sense at all, and it's a command I use heavily)
  • :help currently gets me the help for "Vim 7.4" - NOT Neovim - my suspicion is this is because the Ubuntu package I'm using hasn't set this up properly. Neovim's website makes it fairly clear they have :help but it fails to act as expected on my machine.
  • finding/setting the vimrc file was problematic (as detailed above), but I did discover the very useful :scriptnames command, which tells you all the scripts that were loaded on startup.
  • copying ~/.vim/colors/ wholesale to ~/.config/nvim/colors/ made all of my hand-picked Vim colour schemes available in Neovim, and they seem to be working fine
  • in fact, it's loading not only my long and complex vimrc file but all of my accumulated plugins (both installed and ones I wrote) without complaint

Imagine me dancing for joy: I spend as much as twelve hours a day in Vim, improvements to it make me VERY HAPPY!