Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
Over the past few years, Vim has changed. It has grown and morphed into a more modern piece of software. Something thatâs responsive and features rich.
If youâre like me and been using Vim 7.4 for years and years, it came with great surprise that newer and better versions came to be.
In this piece letâs talk about how we can migrate from Vim 7.4 to a modern version of Vim (Vim 8, Neovim).
Letâs focus on switching to Neovim, because switching to Vim 8 should be almost effortless. The configuration files will be on the same place and once installed it should be working with all your previous configs out of the box.
There are two ways (using Linux) to install Vim 8:
- Using the unofficial PPA:
- sudo apt-add-repository ppa:jonathonf/vim
- sudo apt update
- sudo apt install vim
2. Download the latest version from the official website and build it on your own.
For Mac Os users, brew upgrade vim should be enough.
Even though Neovim is a fork of Vim, itâs not exactly the same thing. We could argue it is a totally different piece of software, but that would be somewhat radical. But because itâs different, it has a different way of installing.
Once again, we can either use the PPA:
- sudo apt-add-repository ppa:neovim-ppa/stable
- sudo apt update
- sudo apt install neovim
Or use the package manager: sudo apt install neovim.
For Mac OS user, of course: brew install neovim
Neovim is not Vim, and because of that, using $vim to launch it will not work. The better youâll get with that command is an outdated version of Vim or Vim 8 if you happen to have it installed. The correct command to launch Neovim is $nvim.
There are ways to make the $vim command behave like $nvim. It involves turning it into an alias for $nvim. There are loads of resources for doing that all over the internet, but making the change in your head shouldnât be complicated.
One thing that will definitely make our life harder is the fact that all Vim configuration resides on ~/.vimrc. But Neovim uses
~/.config/nvim/init.vim
by default. Because weâre all lazy and donât want to have configuration files duplicated all over our file system, thereâs the option to create a ~/.config/nvim/init.vim with the following content:
set runtimepath^=/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vim/vimrc
What this code does is everytime you launch nvim it searches for your .vimrc file and sources it. This way all your already existing configurations will be still running on Neovim.
And by the way,
Congratulations, you just switched to Neovim!
Having trouble with Vim? Donât know what to put into your .vimrc file? Want to use it for programming? Check out my new book âAn IDE Called Vimâ. It goes through all the basics of Vim, from installing to using it as an IDE.
Changing to Neovim was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.