How do I install Plugins in NeoVim Correctly

Does NeoVim have it's own config file just like vim's .vimrc ? If so where can I get that file in the home directory to make my own custom changes.


Both VIm 8.0 and Neovim have their own built-in package manager.

In VIm 8.0, create the following directories:

  • ~/.vim/pack/*/start (where * may be any name e.g. ~/.vim/pack/jimmy/start): Clone your required plugin into the start directory just as you would if you were installing it for Pathogen. You need nothing more and no commands in your .vimrc file.
  • ~/.vim/pack/*/opt (e.g. ~/.vim/pack/jimmy/opt) for plugins that only need to be loaded as required. For colours, add a directory to the opt directory and then your colours e.g. ~/.vim/pack/jimmy/opt/mycolors/colors/dracula.vim.

In Neovim, the directory structure follows the freedesktop's XDG Base Directory Specification. Your configuration file is in ~/.config/nvim/init.vim, but your plugins go into:

  • ~/.local/share/nvim/site/pack/*/start

See :h packages (VIm 8.0 and Neovim) for more information.


Neovim config file is named init.vim[^1] and its location varies depending on your system:

  • *nix and macOS: $HOME/.config/nvim/init.vim
  • Windows: ~/AppData/Local/nvim/init.vim

You can also use the command :echo stdpath('config') inside neovim to find the config directory.

All your settings can be put into this file if you want to. However, it is often advised to split your config to various files, and then either source those files manually or let Nvim do it for you. An excellent article on how to split your config is from .vimrc to .vim. You can find my example configuration here for a reference.

As for installing plugins, it is easy for beginners to use a plugin manager to do all the chores for you. vim-plug is a good choice. You can use it both on Windows, Linux, and Mac. It is fast and reliable. Follow the documentation of vim-plug to learn how to use it.

Another great plugin manager is packer.nvim, which is written in Lua and has all the fancy features (lazy loading, pint commits, etc.) you will ever want.

Other plugin managers you may want to try: dein, minpac, plugpac (a wrapper around minpac).

[1]: for nvim v0.5+, you can also use init.lua as your config entry point, see here.


try :h init.vim or :h vimrc. You'll see there all the info you're looking for.

Assuming you're on unix machine: If you still wish this file in you home directory than you may symlink it there with:

ln

  Creates links to files and folders.

   - Create a symbolic link to a file (or folder):
     ln -s path/to/file path/to/symlink

optionally you may start nvim with the -u flag and tell it what you wish to use as your initialization file, so you can just nvim -u ~/.vimrc. Finally you may add the following in your terminal initialization file(.bashrc/.zshrc or whatever terminal you're using) alias vim='nvim -u ~/.vimrc' if you really really want to use this file in your home directory without symlinking it but I wouldn't advice to work this way


I will explain it with itchy/calendar example.

Make a folder in: ~/.config/nvim/pack/

Can be like this: mkdir ~/.config/nvim/pack/calendar/start/

go to the folder: cd ~/.config/nvim/pack/calendar/start/

Then clone the repo: git clone https://github.com/itchyny/calendar.vim.git

Do the config on your init.vim file if needed and it is done!