Dein.vim is a dark powered Vim/NeoVim plugin manager.
To put it in plain English, dein.vim is a plugin manager focusing on both installation performance and startup performance.
It looks like a neobunle with vim-plug’s speed, or a vim-plug with neobunle’s feature. The best of both worlds.
In this blog post I will first show minimal configuration for dein.vim, and then try to explain the dark power of dein, if you are interested in what makes dein.vim so fast.
Though dark powered, dein.vim supports vim and neovim.
Sadly, there is no installation script for dein.vim for now.
So let’s manually install it.
First, clone dein.vim’s source.
If you are familiar with neobundle/vundle, you will find dein.vim’s path so different. It is because dein uses a new approach to manage plugin’s source.
Optionally, you can backup your vimrc for profiling, as I will show later.
Then, in your
Fire up your neovim/vim, call dein.vim’s installation function
Wait and brew yourself a cup of (instant) coffee.
Then you can confirm your installation, for example call
The most important feature of dein.vim is lazy load. Here are some typical usages worth mentioning.
The last two lazy loading conditions are not available in Vimplug. While lazy loading according to mode change is very convenient.
From here on I will talk about dein’s internal feature. It’s my personal observation, please pardon my mistake and misunderstanding.
dein.vim is fast because it uses dark power
precomputed runtimepath dein.vim will copy all plugins’ subdirectory into a cache directory. This merges all runtime VimScript files into one directory. So dein doesn’t need to compute runtimepath on startup.
Dein.vim also ditches command usage in favor of function calling, which may also contribute to performance(I’m not sure, though).
Because dein.vim uses parallel processing, when errors occur in installation it may be hard to figure out which plugin went wrong. Usually you can see the error messages by
:message after all plugin finished fetching (regardless of success or not). Or you can use
Also, precomputed cache makes modifying plugin harder. You will need to call
dein#recache_runtimepath() after modification. This also applies to disabling plugins.
Lastly, if you happen to live in a country with stupid censorship which prevents github access. You will need a proxy and set
g:dein$install_process_timeout to a larger value.
For more info please refer to doc.
Profiling vim’s startup time has a rather standard method. You can try it by backup old vimrc and compare it to dein.
From the log, I can see dein.vim gives me 20ms startup boost! Mainly from boosting
sourcing vimrc. Amazing!
If you use a lot of plugins, dein is definitely a must-try!