Install and Manage vim Plugins in Ubuntu 22.04

Vim is an advanced featured text editor supported by Linux distributions such as Ubuntu 22.04. It contains valuable tools for programmers. An application like a notepad, it can be used and configured in a very simple way. Moreover, Vim is fast and enriched with advanced features for all kinds of text editing.

The main objective of this educational post is to give an overview of how to install and manage the Vim plugins on Ubuntu 22.04.

How to Install and Manage Vim Plugins in Ubuntu 22.04?

The steps below will install and configure the Vim plugins manually in Ubuntu 22.04.

Step 1: Install Vim From Ubuntu Repository

In Ubuntu, the apt is a package manager which is used to install, remove and update Ubuntu packages. To install the Vim editor the following command can be run from the terminal:

sudo apt install vim -y

Step 2: Install curl Using “apt”

The curl is used to download the packages file from the internet with a single command. The command, as given below, will download the curl package along with its libraries from Ubuntu’s repository:

sudo apt install curl

Step 3: Download the Vim Plugins

Once you have set the environment for Vim, now you can download the plugins for Vim. Here is the direct link to download the Vim plugins by running the given-below command from the terminal:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs


Step 4: Make/Create a Specific Directory for Vim

The following mkdir command will create a separate directory in your desired destination path, such as ~/.vim/plugged:

mkdir -p ~/.vim/plugged

Step 5: Create and Edit the Vim Configuration File

At this stage, create or edit the Vim configuration file. Thus, run the command from the terminal to create and open the Vim editor:

vim ~/.vimrc

After running the vim ~/.vimrc command, a new window will appear on your screen. Write down the following script and save the file by pressing “Esc, :w”, before closing.

Step 6: Write your Plugins Script

In your script file, add the plugins in the below-given format:

call plug#begin('~/.vim/plugged') 

" Add your plugins here 
Plug 'tpope/vim-fugitive' 

call plug#end()

Note: You can add more plugins as per your need and requirements. But keep in mind these plugins must be in the body as mentioned above snapshot.

Step 7: Run the PlugInstall Command

To install the Vim plugins in your Ubuntu machine, the following command will be used within the vim ~/.vimrc. Press the Esc button from your keyboard to turn on the command mode:


After executing the “:PlugInstall” command, the following interface will be displayed on your screen.

As per the above snapshot, the new plugin has been installed, successfully.

How to Remove the Vim Plugins From Ubuntu 22.04?

To remove the installed plugins from your machine, open the terminal and navigate the directory path. For example, we have stored all the Vim plugins in ~/.vim/plugged. Change the directory to the particular path using the following command:

cd ~/.vim/plugged

Run the written below command from your terminal to remove the particular directory.

rm -r vim-fugitive

It can be seen in the above screenshot, the vim-fugitive plugins have been removed from the Ubuntu machine, successfully.

Bonus Tip: If you are facing a problem during the execution of the “:PlugInstall” command. Then, You have to do the following step to resolve your problem:

sudo apt install git -y


Vim plugins can be installed in Ubuntu 22.04. While using the command “sudo apt install vim -y” will install the Vim text editor on your machine. The command “vim ~/.vimrc” will create a configuration file. Once all the configuration process is completed, execute the “:PlugInstall” command within Vim to install the plugins.

In this educational post, we have discussed the Vim text editor, its installation, and its configuration. Furthermore, we have practically managed the Vim plugins on Ubuntu 22.04.

Print Friendly, PDF & Email