Video

Want to see the full-length video right now for free?

Sign In with GitHub for Free Access

Notes

Installing NeoVim

The NeoVim wiki page has installation instructions for various unix platforms, as well as showing how to build from source.

I'm running mac os ten, so I'll follow the advice on how to install neovim using homebrew.

brew install neovim/neovim/neovim

This command fetches the latest stable release, which is currently 0.1.7. If you want to get all of the latest features and fixes, you might prefer to follow HEAD. The NeoVim wiki documents any breaking changes that you may need to be aware of. I usually run the latest release and rarely have any problems, but for this video we'll stick with the stable release.

Once NeoVim is installed, we can launch it with the nvim command.

Migrating from Vim

NeoVim works fine but it doesn't load any of our vim configuration files. At a glance, you can see that vim is using my chosen colorscheme: solarized8, whereas nvim is using a default colorscheme. Let's set things up so that NeoVim uses our existing Vim configuration.

Vim looks in the user's home directory for a .vim directory which may contain runtime files. And the .vimrc file is also typically kept in the user's home directory. NeoVim doesn't follow the same conventions here as Vim. Instead, it conforms to the XDG Base Directory Specification.

:help base-directories

That means we should keep all of our NeoVim configuration in a .config/nvim directory. And instead of looking for a .vimrc file in our home directory, NeoVim looks within its config directory for a file called init.vim.

We can make Vim and NeoVim use the same configuration files by setting up a minimal init.vim file.

We'll create the ~/.config/nvim directory. Then we'll create an init.vim file inside the new directory

mkdir -p ~/.config/nvim
nvim ~/.config/nvim/init.vim

Here', we're going to add the ~/.vim directory to NeoVim's runtimepath, and the after subdirectory too. We'll also add the ~/.vim directory as a packpath, so that any plugins loaded by the packages feature are also available to NeoVim. And finally, we'll source our .vimrc file.

set runtimepath+=~/.vim,~/.vim/after
set packpath+=~/.vim
source ~/.vimrc

Now when we launch nvim, we can see right away that it's loaded the solarized8_light colorscheme. Both Vim and NeoVim are now loading the same vimrc and the same set of runtimefiles.

Differences between Vim and NeoVim

NeoVim has removed a lot of cruft from Vim. Some features have been removed, and some of the default settings have been changed. And NeoVim has added cool new features, some of which we'll explore in other videos. The help page on vim-differences documents these changes in detail. It's worth reading in your own time.

Plugins generally work fine

NeoVim can run most Vim plugins just fine. For example, I've got the surround.vim plugin installed. The mappings work just the same in NeoVim as they do in Vim. As a general rule, if a plugin has been around since before version 8 of Vim came out, then you can be confident that it will work fine in NeoVim.

The one area where you have to be cautious is with any plugin that uses job control to perform work asynchronously. NeoVim came out with this feature first, way back in 2014. Vim released a similar feature with version 8, but the job control APIs are different. Some plugins offer async functionality whether you run them in Vim 8 or in NeoVim, but some plugins may only work in one or the other. Since the job control functionality is relatively new, this problem doesn't affect that many plugins, but it is something to watch out for. This problem doesn't affect that many plugins since the job control functionality is relatively new, but it is something to watch out for.

NeoVim can run any plugin written in Vimscript. But it also supports remote plugins, which can be written in any language. These run in a separate process, using remote procedure calls (RPC) to communicate with the neovim process. Remote plugins are a game changer for plugin authors.

On the wiki, there's a list of plugins that exploit NeoVim's features, such as remote plugins and the built in terminal. I expect to see this list growing over time.


The unite.vim plugin by Shougo makes an interesting case study. This is a popular plugin, but it's always been plagued by poor performance. It's implemented in Vimscript, which is very slow for the kind of work that unite does. The author has given up on trying to fix these performance issues, and started a new plugin called Denite. All of the heavy-lifting is now performed in a separate Python process. Denite does not yet support all of the features of unite.vim, but it performs much more snappily. If you want to extend the functionality of Denite, you can do so by writing your own plugin in Python. It's a good showcase for NeoVim's remote plugins.