How to Install Plugins in Neovim

Posted by Chaitanya Shahare on Sun, Nov 20, 2022

We are going to use a plugin manager ‘vim-plug’ for installing & managing plugins in neovim.

The following tutorial is for Neovim & not for Vim.

Vim-Plug plugin installation gif preview

Create Config

Create a directory for Neovim config if not already

mkdir ~/.config/nvim

Create an init.vim file

touch ~/.config/nvim/init.vim

Vim-plug installation

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

Create a file for plugins

Create a new file plugins.vim for organisation.

mkdir ~/.config/nvim/vim-plug

touch ~/.config/nvim/vim-plug/plugins.vim

Adding plugins

Add the following to ~/.config/nvim/vim-plug/plugins.vim

" auto-install vim-plug
if empty(glob('~/.config/nvim/autoload/plug.vim'))
  silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
  "autocmd VimEnter * PlugInstall
  "autocmd VimEnter * PlugInstall | source $MYVIMRC

call plug#begin('~/.config/nvim/autoload/plugged')

    " Better Syntax Support
    Plug 'sheerun/vim-polyglot'
    " File Explorer
    Plug 'scrooloose/NERDTree'
    " Auto pairs for '(' '[' '{'
    Plug 'jiangmiao/auto-pairs'

call plug#end()

We are adding 3 plugins they are optional but copy the rest of the snippet.

To add a new plugin add between call plug#begin() & call plug#end() in the following Syntax

	" Comment for the plugin
	Plug 'author/plugin-name'

Source plugins.vim

To source plugins.vim to init.vim add the following to init.vim

source $HOME/.config/nvim/vim-plug/plugins.vim

Vim-plug commands

Open nvim


Plugin Status

Check the status of your plugins


Installing Plugins

Install all plugins


Updating Plugins

To update your plugins


Removing Plugins

To remove plugins

  1. Remove the plugin from plugins.Vim
  2. Use the following commands