How to install a plugin in Vim
Vim is a versatile, powerful, and lightweight command-line text editor that has proven indispensable over time.
You can install Vim on Windows, macOS, Unix and Linux. In fact, most Unix and Linux based systems come with Vim by default. One of the best ways to extend Vim’s functionality is through plugins, and here’s how you can install plugins in Vim.
Why install Vim plugins?
Vim is a feature-rich editor; it is also modular and highly customizable. If the Vim editor doesn’t come with a function or feature you’re looking for, chances are you can probably find a plugin for it or, at worst, create a plugin yourself. Often there is already a plugin for the functionality you are looking for.
Plugins are one of Vim’s most popular features because they allow you to extend Vim’s functionality while keeping the base program size light and relevant. The concept of plugins or extensions is emulated in most graphical editors such as Visual Studio Code (VS Code), Atom, etc.
Vim Plugin Installation Methods
There are two main methods for installing plugins in Vim. The first method is to install a plugin manually by copying the contents of the plugin to a designated folder. The other, and most common, method is to install plugins through a plugin manager.
Let’s take a look at both methods so you can choose which one best suits your needs. Also, it is important to note that there are several plugin managers that you can use.
You will need to install Git on your PC for both methods of installing the plugin.
1. Install a plugin manually
Starting with Vim version 8, you can install plugins without needing a package manager by using the default package manager tool.
You can place Vim plugins in the ~/.vim/pack/vendor/start/plugin_name phone book. Note that the plugin_name the folder name will vary from plugin to plugin. To illustrate this point, let’s install a Vim plugin called NERDTree. It is a widely used filesystem explorer for Vim. NERDTree lets you view a project folder structure in a tree view.
First, change your directory to the home directory using the following command:
Then locate the .vim folder with the command ls-al, to show hidden files and folders. Navigate to the folder if it exists.
If you don’t have the .vim folder in your home directory, create the folder structure for the NERDTree plugin we want to install using the command below:
mkdir -p .vim/pack/vendor/start/nerd_tree
Vim recommends that you create a separate folder for each plugin for easy management. So if you need to install another plugin, you will create a new folder for the plugin in the ~/.vim/pack/vendor/start/ phone book.
Next, download the NERDTree plugin from GitHub and place it in the nerd_tree plugin directory using the following command:
git clone https:
Most plugin pages will contain instructions on how to download a plugin from its source.
Start the Vim editor then type the command : NERDTree to open the NERDTree file explorer. Here is an ASP.NET Core Web API project opened in Vim using NERDTree.
To uninstall a plugin, simply delete its corresponding plugin folder (in this case, nerd_tree).
2. Install Vim plugins with a plugin manager
Package managers were the traditional way to install plugins in Vim, before Vim version 8. They are supported in all versions of Vim and there are several package managers you can use to install plugins.
Some of the more notable plugin managers include Vundle, VAM, vim-plug, pathogen, etc.
The advantage of plugin managers is that you are not involved in manually creating the folder structure and it is easier to update packages automatically.
Let’s install a plugin via vim-plug. It is widely used in the Vim community, so it has great community support and is also well documented.
First, install vim-plug using the command:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https:
Next, create an entry for your plugin in the ~/.vimrc file. If you don’t have the ~/.vimrc file, you can create it using the touch ~/.vimrc ordered.
Enter the following text in your ~/.vimrc file.
All plugins you intend to install should be placed in the line call plug#begin() and call plug#end(). In this case, we want to install NERDTree. After adding the plugin names, save the file.
Open your Vim editor and run the command :PlugInstall to install the plugin. Restart Vim for your changes to take effect.
Customizing the Vim Editor on Linux
We looked at how to customize and extend Vim’s functionality by installing plugins. The ~/.vimrc is the best place to add custom Vim configurations if you want the editor to look good.