Are you a Neovim fan? Then definitely love to try some Plugins that provide additional functionality and extend the capabilities. Plugins can be installed manually or by using a plugin manager. Most users prefer to use plugin managers. Some of the popular plugin managers are vim-plug, dein.vim, minpac and packer.nvim.
In this tutorial, we learn how to use vim-plug to install plugins in Neovim command-line text editor.
Step 1. Install neovim
Neovim is by default present in the official repositories of most Linux Distributions. On Ubuntu, you can use the apt command to install it.
sudo apt install neovim
Next, we can install vim-plug to manage all the plugins we will need to install.
Step 2. Install vim-plug
vim-plug is a modern plugin manager which allows you to easily install, upgrade and remove plugins. The manual process required downloading the files and extracting them in a single directory, but this could become a mess when having a lot of plugins to install. But by using a plugin manager, it will download the plugins into separate directories and make sure that they are loaded correctly.
Vim plug requires git, make sure git is installed on your system.
sudo apt install git
To install vim-plug on Neovim you need to download plug.vim and put it in the autoload directory located in the .local/share/nvim hidden folder.
$ curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 83127 100 83127 0 0 42450 0 0:00:01 0:00:01 --:--:-- 42433
Neovim follows the XDG base directory structure and configuration information is stored in ~/.config/nvim/init.vim file. To find neovim config location you can run
:echo stdpath('config') command from inside neovim.
If nvim folder not present under ~/.config directory create it using the following command:
Create the neovim configuration file named init.vim inside ~/.config/nvim/ directory.
In this file, we will add instructions about the plugins to install.
Step 3. Install Neovim Plugins using vim-plug
Open init.vim configuration file using nvim command and add the following lines.
call plug#begin('~/.local/share/nvim/site/plugged') Plug 'junegunn/goyo.vim' call plug#end()
- call plug#begin('~/.local/share/nvim/site/plugged') indicates the plugin directory.
- Plug 'junegunn/goyo.vim' indicates the plugin that will be installed from a git repository.
- call plug#end() indicates the end of the instructions for the plugin's installation.
The location where Neovim plugins are stored depends on the plugin manager you are using. For vim-plug you can create your own plugin directory inside ~/.local/share/nvim/.
You will need to close the file and run the neovim command to open the text editor
Now you should run the command to install the plugin still from inside neovim with
You will see the current progress and a message will appear when the installation will finish
To add a new plugin, edit ~/.config/nvim/init.vim file and update plugin information. For example:
:PlugInstall command to see the following output:
The output shows all the previous plugins which were installed and status of the current plugin.
To uninstall the plugin, you can simply remove the add lines added in the configuration file and run :PlugClean command.
In this short tutorial, we learn how to install Neovim plugins using Vim-plug. Make sure to update vim-plug tool using
:PlugUpgrade command to keep it on the latest version.
For more information about packages type
:h package from inside neovim.
Thanks for reading, please leave your experience installing it, in the below comment section.