Migrating to neovim

— Updated on 22 jul 2018

Neovim is an enhanced rewrite of my all-time favorite text editor vim. After going through a couple of reads, predominantly Geoff Greer's write up and this totally unrelated video, where the speaker goes into why he moved away from vim, I decided to take a chance with neovim / nvim.

If you don't have a ton of plugins in your $HOME/.vimrc file, you won't find an exponential performance difference between nvim and vim. Check out slant's comparison on the two.

Installation

In Ubuntu 18.04, neovim is in the default repos. A simple $ sudo apt install neovim would do the trick. However, if you're the ppa type, issue the following

$ sudo apt install software-properties-common
$ sudo apt install python-software-properties
$ sudo add-apt-repository ppa:neovim-ppa/stable
$ sudo apt update
$ sudo apt-get install neovim

Migration

We need to tell the system to use neovim instead of vi or vim. For that,

$ sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
$ sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60
$ sudo update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 60

Now we need to adapt our old vim configs to neovim. For that make nvim's config folder with $ mkdir ~/.config/nvim. Then copy our $HOME/.vimrc file to this folder with $ cp ~/.vimrc ~/.config/nvim/init.vim. Finally, we copy over our $HOME/.vim folder with $ cp -rf ~/.vim/* ~/.config/nvim/. At this point, I remove vim from my machine with a $ sudo apt remove vim and all configs with a $ rm -rf ~/.vim*.

Fin

With this post, I'm in no way asking anyone to replace vim with nvim. I had a bit of trouble setting things up first and wanted to help new nvim users find their way.

Happy Hacking & have a great day!