Neovim is awesome
Like many developers in the Ruby community, and around half of the developers at carwow, I use and love Vim. There are a lot of different reasons why people use and love Vim, mine is that it synergises with my philosophy that text editors should primarily focus on increasing productivity for manipulation of text. Vim excels at this.
About two months ago, one of our resident vim-wizards told me to try out Neovim. “It fixes all the issues with Vim, while being backwards compatible with all your plugins” was the sales pitch.
Issues? What issues?
Being relatively new to Vim (~6 months of usage), I was very much in the honeymoon phase. I couldn’t really think of any issues with my newest revolutionary tool; but I’ve always kept an open mind (which is how I came to learn to use Vim in the first place) so I gave it a go.
Fast forward to today, and I can freely admit that I’m a believer. While Vim is a great tool, my time with Neovim highlighted things I wished Vim had. Neovim has managed to improve the Vim experience, while keeping the core essence of what makes Vim special to me.
So I thought I would share my findings with you with the hope that you give it a go too if you’re a Vim user:
It’s easy to switch to
Partly because it’s not really a switch. Neovim is almost a superset of Vim, and extends it with features you didn’t know you needed, while keeping backwards compatibility.
Neovim is an extension of Vim: feature-parity and backwards compatibility are high priorities. If you are already familiar with Vim, see :help nvim-from-vim to learn about the differences.
Want to ‘switch’ to Neovim from Vim? On OSX, it’s as easy as:
brew tap neovim/neovim
brew install neovim
ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim
Did Neovim do something you don’t like? Need to use vim for a particular reason? Just run
vim and continue as you did before.
Neovim comes with sane defaults which means that newcomers will find things a little more familiar and a little easier to get used to.
syntax enable gives you syntax highlighting out of the box, and
filetype plugin indent on turns on
indent - useful settings to have out of the box, especially for external plugins to work their magic.
If you’re an expert, however, feel free to customise every nook and cranny as you normally would.
Asynchronous plugin support
You don’t know how much you want asynchronous plugin support until you have it. It makes a huge difference, especially when you have larger codebases that you may need to traverse.
Neovim has incredible support for async plugins, allowing heavy processing to be pushed to the background and results to update the UI when they are ready. Locking the UI while waiting for a plugin is a thing of the past.
Note: Back when I started using Neovim, there was no async support in Vim. Vim 8 now also comes with async support (why it took 8 major releases over 25 years to add is a different story in itself).
Open a split, type
:terminal and enter commands all without leaving the editor. It’s a nice workflow that has proved to be useful on several occasions. There is also a
t namespace for key bindings that only work in the terminal, e.g.
As with all software, not everything is sunshine and roses. Here are some reasons you may not want to use Neovim:
Vim is rocking it’s 8th major release however, as of the time of writing this blog post, Neovim is currently sitting at version
0.1.7. This may excite or scare you, depending on the type of person you are. Bugs will occur, and features are still yet to come. If you don’t like trying out immature software, the Neovim is probably not for you.
(A few) workarounds
To navigate my splits easier, like most vim users, I remapped the keybindings to feel more natural. In Neovim, remapping
ctrl-h doesn’t work as expected. A workaround is required for expected behaviour, while the bug is being worked on.
Below is my workaround (macOS):
" Hack to get C-h working in neovim
nmap <BS> <C-W>h
Neovim is awesome. It fixes little niggling issues that Vim has, while not straying away from the true Vim philosophy — which is vital. The maintainers are also dedicated to making the codebase a lot cleaner and easier to contribute to for newcomers. The future looks bright for the project, and I hope the contributors continue to make life easier for developers who believe in the Vim philosophy.