How to install Neovim from source on Ubuntu 20.04 LTS
A simple installation guide
Why from source?
While Neovim can indeed be installed from the corresponding Ubuntu package, there are attractive reasons to install this awesome text editor from source:
- Access to the latest features of Neovim
- Install Neovim in the location you wish
Installation
(1) Install the build prerequisites:
sudo apt-get install ninja-build \
gettext libtool libtool-bin \
autoconf automake cmake g++ \
pkg-config unzip
(2) Clone the Neovim repository:
git clone https://github.com/neovim/neovim.git
(3) To install the stable release, run the following (otherwise the latest version of Neovim will be installed):
git checkout stable
(4) Build Neovim with build type ‘Release’ for better performance and in the location of your choice:
make CMAKE_BUILD_TYPE=Release \
CMAKE_INSTALL_PREFIX=<NEOVIM_LOCATION> install
(5) Add the following line to your .bashrc file:
export PATH=”<NEOVIM_LOCATION>/bin:$PATH”
(6) Enjoy Neovim:
nvim awesome-file.txt
(7) Make sure that everything is in order by typing :checkhealth inside Neovim and verify that the output is similar to this:
If anything went wrong
If something went wrong during the installation, try the following:
(1) Run the following command in the location where you clone the Neovim repository:
rm -rf build .deps # the command 'make distclean' performs the same
(2) Try again the installation process
Uninstall
If you wish to uninstall Neovim, it is pretty simple:
sudo rm -rf <NEOVIM_LOCATION>