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 operating system.
Prerequisites
- A user with sudo privileges.
- An Ubuntu system.
- Ncurses libraries.
- The following Linux packages: git, make, build-essential
Steps For Installing Vim on Ubuntu
To install the latest version of Vim on Ubuntu, first add the necessary prerequisite packages. Next, pull the latest image from GitHub.
Follow the steps below to install the latest version of Vim on your Ubuntu system.
Step 1: Install Necessary Tools
1. Before you install any application from GitHub, the system needs to meet certain requirements. Run the following commands:
sudo apt-get install libncurses5-dev libncursesw5-dev
This command installs two required ncurses packages. The last few lines in the output should look similar to this:
2. Once that's done, install git with this command:
sudo apt install git
3. After git, install the make tool. The make tool builds and installs packages from non-official repositories.
sudo apt install make
4. Finally, install the build-essential package which contains the necessary compiler:
sudo apt install build-essential
Give it a minute or two to complete, and you are ready to install the latest version of Vim from GitHub.
Step 2: Install Vi Improved (Vim) Text Editor
1. Download Vim from its GitHub repository to your machine:
sudo git clone https://github.com/vim/vim.git
2. 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
3. Build the software with the make
tool. In the terminal, enter:
sudo make
Let the system finish building the program from its source code.
4. 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:
Vim is now installed.
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.
How to Uninstall Vim
1. If you decide to uninstall Vim, remove it by running the following command from vim/src:
sudo make uninstall
2. Type in the sudo password and press y
to confirm.
This 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.
Conclusion
This guide showed you how to install the latest Vim editor on Ubuntu. Make sure you have all the tools available before you start building and installing Vim from the repository.