How to install the latest Vim on Ubuntu 16.04
What is Vim?
Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. Read more.
Install the download and build dependencies
We can download package information from all configured sources:
$ sudo apt update
We need to install Git to download the latest version of Vim from the official repository:
$ sudo apt install -y git
We will compile and install the software from the source to get the latest version of Vim. We need to satisfy the build dependencies to compile the software.
To do this, we can install the build-essential package:
$ sudo apt install -y build-essential
Download, compile, and install Vim
We need to choose the target directory where we will download Vim.
Let's download it into /tmp/vim. Before downloading, we need to try to remove /tmp/vim to ensure that this directory is not busy:
$ rm -fr /tmp/vim
Download Vim to /tmp/vim:
$ git clone https://github.com/vim/vim.git /tmp/vim
Compile the Vim binaries:
$ make -C /tmp/vim
Install the binaries into the system:
$ sudo make install -C /tmp/vim
We do not need to keep the downloaded Vim binaries so that we can remove /tmp/vim:
$ rm -fr /tmp/vim
Successfully finishing all steps above, we can use the latest vim. Enjoy!
All steps together:
#!/usr/bin/env bash
sudo apt update
sudo apt install -y git
sudo apt install -y build-essential
rm -fr /tmp/vim
git clone https://github.com/vim/vim.git /tmp/vim
make -C /tmp/vim
sudo make install -C /tmp/vim
rm -fr /tmp/vim
