Hello, friends. In this post, you will learn how to get the latest version of VIM on Ubuntu 20.04.
VIM is a text editor in the terminal that is presented as an improved version of the mythical Vi. That is why many developers and sysadmin prefer to use it rather than nano
or other.
Ubuntu 20.04 is the latest LTS version of Ubuntu, but it is almost two years since it has been released and some programs are becoming obsolete. That is why many people prefer to take advantage of this moment, to update certain applications.
One of those applications is VIM that although it has a slow development is continuous and every so often presents us with a new stable version loaded with important improvements.
So in this post, we will show you how to do it by compiling the source code of VIM and thus have a stable and secure binary. In addition to this, we will install it in a directory of our directory, so we will not have problems with the system.
Let’s go for it.
Get the latest version of VIM by compiling the source code
First, before we get started, we have to make sure that we don’t have VIM installed on the system.
sudo apt remove vim
After this, as we are going to compile from source code, we need to install the basic packages to do it. This can be done by running the following command.
sudo apt install build-essential
Moreover, VIM requires a package called ncurses-dev
that we have to install and also to unzip the source code, we need unzip
.
sudo apt install ncurses-dev unzip
Now create a dedicated folder for VIM installation. It can be in any path you want with any name you want.
mkdir vim
Now download the VIM source code thanks to the wget
command.
wget https://github.com/vim/vim/archive/master.zip
Unzip the file
unzip master.zip
Access the folder that has been generated:
cd vim-master
And then to the folder where the source code is:
cd src/
And proceed to configure it with a directory that does not require root permissions. Although this is not mandatory, it is recommended.
./configure --prefix=/home/angelo/vim
Then compile the code
make
Finally, do the installation by generating the binary.
make install
VIM is installed, and we have generated the binary, but now we need to add the directory I have specified to the PATH.
To complete this, edit the file ~/.bashrc
.
nano ~/.bashrc
And at the end of the file, add the following line.
export PATH=/home/angelo/vim/bin:$PATH
Remember to replace this with the address you have specified.
Save the changes and close the editor.
Apply the changes by running
source ~/.bashrc
Now run the vim
command.
vim
You will see the following screen.
So, the process is done and well.
Conclusion
In this post, you learned how to compile the VIM source code to get the latest stable version. I hope it will be useful to you at some point.