Plugin Management with Dein in NeoVim
  |   Source

In the old days, Emacs featured a complex set of extensions and vi was pretty bare bones by comparison. Those days are gone.

Vim and NeoVim both support a fairly vast selection of plugins and vim plugins are often usable in NeoVim, though the configuration may vary some. And, to some extent they've a better implementation; pulling directly from Git repositories rather than through a central distribution, like Elpa or Marmalade.

This article covers the basics of how to set up NeoVim for extensions and add new extensions.


When NeoVim starts, it loads the vimscript located at $HOME/.config/nvim/init.vim. Personally, I prefer to use this file for package configuration, using $HOME/.nvimrc for more general settings, but you can adapt this model to suit your own particular needs.

First, download Dein for vim package management:

$ curl >

Then run the installer:

sh ./ ~/.cache/dein

These are the default instructions as defined on GitHub, at the moment. Check for updates if it doesn't work for you.

Add the following lines to your init.vim to set up Dein:

" Dein Package Configuration
if &compatible
  set nocompatible

set runtimepath+='~/.cache/dein/repos/'

if dein#load_state('~/.cache/dein')
  call dein#begin('~/.cache/dein')

  call dein#add('~/.cache/dein/repos/')

  " Packages

  " Installation
  if dein#check_install()
     call dein#install()
     let pluginsExists=1

  " Add plugins
  " ...

  call dein#end()
  call dein#save_state()

When you start NeoVim, it loads init.vim, then attempts to load state on the plugins listed in the if block. Any plugin it finds that is not installed, it downloads and installs in the ~/.cache/dein directory.

If you ever want to update your plugins, issue the update command:

:call dein#update()