How to Switch from Vundle to vim-plug

March 10, 2015

I just switched over from vundle to vim-plug. Part of the reason why is because I’m now trying out Neovim, which allows for asynchronous plugins, and vim-plug supports installing plugins ascynchronously. Another reason is that it supports post-update hooks, which means that I can install YouCompleteMe, without having to manually go and run the install script after installing it.

Here’s what I did.

Install vim-plug.

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \

Update vimrc

Then update your .vimrc by removing the old vundle stuff:

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'gmarik/Vundle.vim'

" Plugins go here

call vundle#end()
filetype plugin indent on

And add the vim-plug stuff before and after your list of plugins:

call plug#begin('~/.vim/plugged')

" Plugins go here

call plug#end()

Then change all the Plugins from Plugin to Plug:

call plug#begin('~/.vim/plugged')

Plug 'junegunn/seoul256.vim'
Plug 'junegunn/vim-easy-align'

call plug#end()

Add Post-Update Hooks

If you have plugins (like YouCompleteMe), you can add a post-update hook to run any additional commands after they install.

function! BuildYCM(info)
  if a:info.status == 'installed' || a:info.force
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }

This is what I have for Tern:

function! BuildTern(info)
  if a:info.status == 'installed' || a:info.force
    !npm install
Plug 'marijnh/tern_for_vim', { 'do': function('BuildTern') }

And this is what I have for syntastic, since it requires jshint:

function! Installjshint(info)
  if a:info.status == 'installed' || a:info.force
    !npm install -g jshint
Plug 'scrooloose/syntastic', { 'do': function('Installjshint') }

Install Plugins

Open vim and run :PlugInstall

Remove Vundle Plugins

You can remove the plugins installed with vundle, which are in the bundle directory, since vim-plug installs them in the plugged directory.

rm -rf ~/.vim/bundle

Update gitmodules

If you get a message saying that you have modified content, you can update your .gitmodules file to ignore them.

[submodule "nvim/plugged/YouCompleteMe"]
	path = nvim/plugged/YouCompleteMe
 	url =
 	ignore = dirty

Profile picture

Written by Adam Garrett-Harris, a podcaster and software engineer in Utah. You should follow him on Twitter