How to Install Vim on Ubuntu

By
Sara Zivanov
Published:
February 11, 2025
Topics:

Vim (Vi Improved) is an enhanced version of the original Vi text editor. With features such as syntax highlighting and new editing commands, like multiple undo levels, visual mode, and block operations, Vim is one of the best text editors for the development environment.

Vim comes pre-installed with most Linux distributions, but if you want the latest version with the newest features, you may need to compile it from source using Git.

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

Tutorial on how to install the Vim editor on Ubuntu

Prerequisites

Steps for Installing Vim on Ubuntu

To install the latest Vim version on Ubuntu, get the required prerequisite packages. Then, clone the latest source code from GitHub.

Follow the steps below to complete the installation on your Ubuntu system.

Step 1: Install Necessary Tools

Before installing Vim from GitHub, ensure your system has the necessary tools. Take the following steps:

1. Install required development libraries with:

sudo apt install libncurses-dev
sudo apt install libncurses-dev terminal output

This installs the ncurses development libraries, which Vim uses for terminal-based text display, cursor movement, and keyboard input.

2. Install git with this command:

sudo apt install git
sudo apt install git terminal output

3. Install the make command with:

sudo apt install make
sudo apt install make terminal output

The tool builds and installs packages.

Note: In the newest Ubuntu versions, make is already installed.

4. Install the build-essential package, which contains the necessary compiler:

sudo apt install build-essential
sudo apt install build-essential terminal output

Step 2: Install Vi Improved (Vim) Text Editor

To download and install Vim, take the following steps:

1. Download Vim from the GitHub repository:

git clone https://github.com/vim/vim.git
git clone https://github.com/vim/vim.git terminal output

2. Navigate to the Vim source directory using the cd command:

cd vim

3. Configure the build environment with:

./configure --with-features=huge --enable-multibyte --enable-python3interp=yes --enable-cscope --prefix=/usr/local
Configure the build environment terminal output

4. Build the software with the make tool. Run the following:

make
make terminal output

5. Install Vim with:

sudo make install
sudo make install terminal output

Step 3: Verify Vim Installation

To verify the installation process has completed successfully, check the version of Vim on your system.
Run the command:

vim -v
vim -v terminal output

The editor opens and shows you the current version of Vim.

How to Uninstall Vim

To uninstall Vim, navigate to the Vim source directory and run:

sudo make uninstall
sudo make uninstall terminal output

This removes all installed Vim binaries, libraries, and related files. If you no longer need the downloaded Vim source code, delete it with:

rm -rf ~/vim

The command has no output.

Conclusion

This guide explained how to install the latest version of the Vim editor on Ubuntu. Make sure you have all the tools available before you start building and installing Vim from the repository.

Next, learn how to save and exit a file in Vim or check out our Vim commands cheat sheet.

Was this article helpful?
YesNo