Hello, friends. Vim is an application quite used by many, but it is not so easy to have the latest stable version in our system. However, today I will help you with that. After reading this post, you will learn how to install the latest version of Vim on Ubuntu 20.04 / Debian 10.
According to the project website:
Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as “vi” with most UNIX systems and with Apple OS X.
Vim is rock stable and is continuously being developed to become even better. Among its features are:
- Persistent, multi-level undo tree.
- Extensive plugin system.
- Support for hundreds of programming languages and file formats
- Powerful search and replace
- Integrates with many tools
So we can say that Vim is an improved version of the mythical text editor Vi. This makes it very popular among sysadmin and even developers.
The best way to get the latest version of Vim is to compile it from the source code. It is lightweight, does not have many dependencies, and is more secure. So this is the way we will do it.
So, open a terminal or start an SSH session and run it:
sudo apt update sudo apt upgrade
With the system upgrade, we can then install the
build-essential package which contains the package compilation tools.
sudo apt install build-essential
Then create a folder where the compiler package will be. I have chosen this path:
mkdir -p /home/angelo/vim
But you can change it to whatever you want.
Then, download the packages needed to perform the compilation:
sudo apt install ncurses-dev unzip Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'libncurses-dev' instead of 'ncurses-dev' The following additional packages will be installed: libc-dev-bin libc6-dev linux-libc-dev Suggested packages: glibc-doc manpages-dev ncurses-doc zip Recommended packages: manpages-dev The following NEW packages will be installed: libc-dev-bin libc6-dev libncurses-dev linux-libc-dev unzip 0 upgraded, 5 newly installed, 0 to remove and 36 not upgraded. Need to get 4,902 kB of archives. After this operation, 28.0 MB of additional disk space will be used. Do you want to continue? [Y/n]
After that, download the Vim source code using the
wget https://github.com/vim/vim/archive/master.zip --2021-02-15 17:54:39-- https://github.com/vim/vim/archive/master.zip Resolving github.com (github.com)... 220.127.116.11 Connecting to github.com (github.com)|18.104.22.168|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://codeload.github.com/vim/vim/zip/master [following] --2021-02-15 17:54:39-- https://codeload.github.com/vim/vim/zip/master Resolving codeload.github.com (codeload.github.com)... 22.214.171.124 Connecting to codeload.github.com (codeload.github.com)|126.96.36.199|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/zip] Saving to: ‘master.zip’ master.zip [ <=> ] 16.13M 5.85MB/s in 2.8s 2021-02-15 17:54:42 (5.85 MB/s) - ‘master.zip’ saved 
Now decompress it using the command
src folder inside the generated folder
And start the compilation configuration taking as the path the folder we have created.
My recommendation, always when compiling a package from source code, I do it in a location that does not require root privileges and that I can manage. This way if we want to uninstall it, we would only delete the folder where the compilation was configured.
Create the package:
And finally, do the installation:
To test the results, you can access the
bin folder that has been created in the package creation path.
There you will find the freshly compiled binary that you can start using. For example, I will show the compiled version.
./vim --version VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 26 2021 23:50:58) Included patches: 1-2814 Compiled by angelo@osradar Huge version without GUI. Features included (+) or not (-):
And that is it. Enjoy the latest version of Vim.
Having the latest stable version of a program gives us access to improvements and new features as well as bug fixes. Today I have shown you how to get the latest version of Vim quickly and easily.