Introduction

Vim (Vi Improved) is one of the clone versions of the text editor vi. With features such as syntax highlighting and new editing commands, Vim is one of the best text editors for the development environment.

Vim comes standard with most Linux distributions, but if you want the latest available version, you need to use git.

In this tutorial, learn how to install the latest Vim editor on Ubuntu 18.04 operating system.

Tutorial on how to install the Vim editor on Ubuntu

Prerequisites

  • A user with sudo privileges
  • Access to a terminal/command line
  • Ncurses libraries
  • The following Linux packages: git, make, build-essential

Steps For Installing Vim on Ubuntu

Step 1: Install Necessary Tools

Before you can install an application from GitHub, you need to meet the requirements. Run the following commands:

sudo apt-get install libncurses5-dev libncursesw5-dev

This command installs two necessary ncurses packages. The last few lines in the output should look similar to this:

terminal output when installing ncurses packages
Once it’s done, install git with this command:

sudo apt install git

After git, install the make tool. This tool necessary to build and install packages from non-official repositories.

sudo apt install make

The final package to install is the build-essential package which contains the compiler we need.

Enter this command:

sudo apt install build-essential

Give it a minute or two to finish, and you are ready to install the latest Vim from GitHub.

Step 2: Install Vi Improved (Vim) Text Editor

Installing Vim on Ubuntu requires a few steps.

1. Download Vim from its GitHub repository to your machine.

Run this command:

sudo git clone https://github.com/vim/vim.git

git clone command to download files to your system

When the system finishes downloading the files, navigate to the download directory. In this case, go to the vim/src directory by typing:

cd vim/src

2. Build the software with the make tool.

In the terminal, enter:

sudo make

Let the system finish building the program from its source code.

3. Place the program we just built to the correct location. This step includes Vim’s libraries and documentation.

To do so, enter the following command:

sudo make install

The output should look similar to this:

output of sudo install make command ubuntu terminal after installing vim

You are now ready to use Vim 8.2 on your system.

Step 3: Verify Vim Installation

To verify the installation process has completed successfully, check the version of Vim on your system.
In the terminal, run this command:

vim -v

The editor will open and show you the current version of Vim.

Vim showing the version of the application installed on Ubuntu

How to Uninstall Vim

If you decide to uninstall Vim from your system, you can remove it with the following command:

sudo apt remove vim

Then, type in the password and press y to confirm.

removing the vim installation from ubuntu 18.04

This command removes the latest version from the GitHub repository. After this, you can use the apt install vim command if you want to return to the release from the official repository.

New features in Vim 8.2

The latest release of Vim includes a few new features, bug fixes, and documentation updates.

The most significant feature is support for running popup windows allowing you to display text on top of other windows. Other changes include a few new commands and the function chaining for method calls.

Conclusion

This guide showed you how to install the latest Vim editor on Ubuntu 18.04. Make sure you have all the tools available before you start building and installing Vim from unofficial repositories.


Next you should also read