How to install Vim on Debian

Vim is one of the most powerful command-line text editors for Linux and other Unix-based operating systems. It has become very popular and is now the default text editor for many Linux distributions. Once in the hands of a skilled user, it can enable blazing fast edits closer to the speed of thought – much faster than what’s usually achievable with a traditional text editor. Vim is available on many different platforms, including Unix-based systems, Android and iOS smartphones, and even Windows!

In this article, we’ll show you how to install Vim on Debian. While demonstrated on the latest version – Debian 11 Bullseye, the guide is also applicable to older versions such as Debian 10 Buster, as well as many other Linux distros based on Debian such as Ubuntu, Zorin OS or Kali Linux.

Update all packages

Before installing any new package or software application, it is suggested that you refresh your system cache. To do this, run the below-mentioned command to update the apt packages list of the Debian repository.

sudo apt update

Install Vim on Debian using apt

After updating all the packages, you can move on to installing Vim by running the command below.

sudo apt-get install vim
Code language: JavaScript (javascript)

Alternatively, you can run apt-get without sudo in an elevated shell by running:

sudo -s sudo apt-get update apt-get install vim
Code language: JavaScript (javascript)

Once vim is installed, we can verify the installation by outputting the version number of Vim using the command below:

vim --version

Install Vim from source

The Vim which comes from Debian repository is usually not the latest version, because every software release has to go through extensive compatibility tests before it can make it to the distro official repositories. If you’re a hardcore fan of Vim and wants to experience the latest and greatest, bleeding-edge version of the editor, you can follow the instructions below to compile it from the latest source code.

At the time of this writing, the latest stable version of Vim, according to VIM website, is 8.2.

vim compiled from source

Step 1. Run the following command to install the libraries which are needed to compile the source code.

sudo apt-get install build-essential make ncurses-dev
Code language: JavaScript (javascript)

Step 2. We’ll need to download Vim source code from the official repository, then use make to configure and compile it. To do so, sequentially running the following commands.

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
Code language: JavaScript (javascript)

By default, Vim is installed to /usr/local/bin/vim. If you wants to change that, use ./configure --prefix=/path/to/install/vim instead of ./configure in the commands above. Remember to replace /path/to/install/vim with the actual path you prefer to install to.

vim -v

We hope that the information above helped you successfully install Vim on your Debian system. We’ve also covered other software installation for Debian, such as how to install Discord and Chromium, in case you’re interested. If you have any suggestion, please feel free to leave a comment below.

Click to rate this post!
[Total: 1 Average: 4]

Leave a Comment