How to Install Vim on Ubuntu – 4 Easy Ways

Vim is a command-line text editor used to write scripts, change configuration files, or work on remote Linux servers through SSH. Vim for Ubuntu is suitable because it integrates naturally with the Linux command-line workflow, works reliably over SSH, and is available on virtually every Linux system.

4 Ways To Install Vim On Ubuntu

Vim’s modal editing system, extensive customization, and close integration with Linux tools make it exceptionally well-suited for Ubuntu in both desktop and server environments. Vim Text editor comes with different versions based on their functionality. Below is the table that gives commands for installing each version:

 

Vim PackageDescriptionInstall Command
vimThe standard full-featured terminal version of Vim.sudo apt install vim
vim-tinyA compact, stripped-down version of Vim that provides only basic editing features.sudo apt install vim-tiny
vim-noxA Vim build that includes support for scripting languages like Python, Perl, and Ruby.sudo apt install vim-nox
vim-gtkA graphical version of Vim built with the GTK2 toolkit..sudo apt install vim-gtk
vim-gtk3A GUI version of Vim using the modern GTK3 toolkit.sudo apt install vim-gtk3
vim-gnomeA graphical Vim variant integrated with GNOME librariessudo apt install vim-gnome
vim-athenaA lightweight graphical version of Vim using the Athena widget toolkit.sudo apt install vim-athena

1: Through Ubuntu Default App Installer

The Vim text editor is installed by default on Debian-based Linux operating systems, but it is the minimal version, i.e., Vim-tiny, which has limited functionality. To install the complete version of Vim, use the apt package installer by executing the command below:

sudo apt install vim

Installing Vim on Ubuntu via apt package installer

Verify the Vim text editor installation using the version command as given below:

vim --version

Checking Vim Editor version to verify its installation on Ubuntu

2: Through GitHub

Another way to install Vim on Ubuntu is by downloading its source file from GitHub. To download the source file, use the git clone command as given below:

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

Downloading Vim source file using GitHub on Ubuntu

Once the clone is created, move to the src directory under the vim folder:

cd vim
cd src

Navigating to vim source file on Ubuntu

The make file for Vim is already created, so use the make command to compile the source code:

make

Creating Makefile for Vim text editor on Ubuntu

While compiling the source code for the Vim text editor, there might be an error for tgetent() indicating the absence of libraries like ncurses/termcap. The tgetent() is primarily used for functions like cursor movement and colors :

tgetent().... Configure:error: Not Found ! error while creating Makefile for Vim on Ubuntu

To fix the tgetent()…. Configure:error: Not Found !, execute the following command:

sudo apt install libncurses5-dev libncursesw5-dev

Fixing tgetent().... Configure:error: Not Found !error on Ubuntu

Once the source file is compiled successfully, install Vim on Ubuntu via the Makefile that primarily contains all the installation instructions:

sudo make install

To verify the Vim installation on Ubuntu via is source file navigate to the src directory and execute the version command. To access Vim from anywhere, its symbolic link can also be created:

vim --version

Checking Vim Editor version to verify its installation on Ubuntu

3: Through the Ubuntu Software App

Just like Google Play Store and Apple App Store, Ubuntu comes with a software app from which Vim text editor can be installed. First search for it as in the image below:

Searching for Vim text Editor on Ubuntu Software App

Next, to install Vim on Ubuntu, click on Install icon :

Installing Vim Text Editor on Ubuntu via Software App

4: Through Snap Store

Snap is a self-contained third-party app installer primarily created to solve issues with Linux packaging, like dependency conflicts, and features like auto update and rollback. To install Vim on Ubuntu, execute:

sudo snap install --edge vim-editor

Installing Vim on Ubuntu via snap package installer

Next, confirm the installation of Vim by listing snap-installed apps on the system by executing the command below:

sudo snap list

5: Through Flathub Repository

Flathub is a universal packaging system for Linux distributions, as it works on every Linux distribution, which solves the issue of compatibility due to different package formats. To install Vim on Ubuntu via Flathub, execute:

flatpak install flathub org.vim.Vim

Installing Vim on Ubuntu via flathub package installer

To launch Vim text editor via Flatpak, execute the command below :

flatpak run org.vim.Vim

Basic Commands For Vim on Linux

 

Here are some of the basic commands for getting started with Vim Text Editor:

Sr No.CommandDescription
1iEnter’s Insert Mode to start typing text before the cursor.
2aEnters Insert Mode but starts typing after the cursor.
3EscSwitches from the current mode back to the default mode.
4:wSaves (writes) the current file.
5:qQuits Vim. Fails if unsaved changes exist.
6:wq Saves the file and then quits Vim.
7:q!Quits without saving changes.
8ddDeletes the entire current line.
9yyCopies (yanks) the current line.
10pPastes text after the cursor or current line.
11/textSearches forward in the file for the word “text”.
12uRevert the previous modification.
13ggNavigate to the file’s start.
14GNavigates to the last section of the file.

Conclusion

This guide discussed four ways to install Vim Text editor on Ubuntu, which include: using Vim source file, APT package installer, Ubuntu’s software App, Snap, and Flathub store.

Index
Scroll to Top