How to Install Vim Text Editor on Ubuntu

Last updated: June 17, 2022

Vim is the enhanced version of vi text editor. Vim comes preinstalled on Ubuntu. The preinstalled version is minimal. To get the full version of vim, install vim using the apt or apt-get command.

Vim is a powerful text editor, which comes preinstalled in most Linux distributions. Ubuntu comes with Vim, vi, nano, Gedit (GUI), and many other text editors installed.

In this tutorial, we learn how to install VIM Text Editor on Ubuntu using apt.

Install Vim on Ubuntu

Vim is by default installed on Ubuntu. Vim is available in the Ubuntu repository. Ubuntu 20.04 comes with Vim 8.1 version.

To install the latest VIM package available in the repository follow the following steps.

Step 1. Update the Ubuntu package database

sudo apt update

Step 2. Install Vim using apt

sudo apt install vim

Step 3. Check Vim version

vim --version
vim show version

Now you can open, edit and save a file using VIM. To add extra featured, you can go ahead with installing Plugins for VIM.

Compile Vim from the source file

Apt repository not necessarily contains the latest version, it takes some time to have the latest version there. If you are a fan of VIM and need the latest features of VIM, you can compile VIM from the source file.

As of writing this tutorial the latest available version available on the VIM website is 8.2

Let's check how to compile VIM using the source file.

First, install all the necessary prerequisite tools:

$ sudo apt install ncurses-dev
$ sudo apt install make
$ sudo apt install build-essential

Second, following the set to commands to download the source file and compile VIM:

$ wget https://github.com/vim/vim/archive/master.zip
$ sudo apt install unzip
$ unzip master.zip
$ cd vim-master
$ cd src/
$ ./configure
$ make
$ sudo make install

VIM is installed to the directory /usr/local/bin/vim. To install to a specific directory use ./configure --prefix=/path/to/install/vim.

Verify the Vim installation by typing vim -v or which vim.

showing vim latest version which compiled from the source

Now we have the latest Vim 8.2 version.

The distribution provided Vim can be installed using apt remove vim, but it's not mandatory.

Conclusion

In this tutorial, we learned how to install Vim on Ubuntu using apt. We also learned how to compile Vim on Ubuntu to get the latest version.

About The Author

Bobbin Zachariah

Bobbin Zachariah

Bobbin started his career in IT in the year 2000 as a computer science instructor and worked as a Linux system engineer and senior analyst roles. Currently working in DevOps environments to increase efficiency and improve delivery time in AWS Cloud infrastructure. He is certified in RHEL, CCNA, and MCP and holds a Masters's in computer science. When in his free time love playing cricket, blogging, and listening to music.

SHARE

Comments

Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment