13 C
Texas
angeloma
Senior Writer and partner

How to install the latest version of Vim on Ubuntu 20.04 / Debian 10?

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.

Install the Latest version of Vim

- Advertisement -

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 command.

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)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|: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)... 140.82.121.9
Connecting to codeload.github.com (codeload.github.com)|140.82.121.9|: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 [16910770]

Now decompress it using the command unzip

unzip master.zip

Access the src folder inside the generated folder

cd vim-master/src

And start the compilation configuration taking as the path the folder we have created.

./configure --prefix=/home/angelo/vim

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:

make

And finally, do the installation:

make install

To test the results, you can access the bin folder that has been created in the package creation path.

cd /home/angelo/vim/bin

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 (-):

Output:

And that is it. Enjoy the latest version of Vim.

Conclusion

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article