How to Switch From Vundle to Vim-Plug the Easy Way11 April, 2020written by Bill

Recently i just switched to vim-plug. I've searched on the internet for better alternatives, and end up with vim-plug. There is no important reason why i switched over from Vundle to vim-plug.

Installing vim-plug is quite easy (see documentation), since i've already installed some plugins with Vundle, there is a useful tips to retrieve the installed plugins on Vundle directory and copying them to vim-plug directory, so i don't need to install all plugins over internet again.

Update .vimrc file

Before doing it, i recommend you to backup it first. Open your .vimrc file and find Vundle setup, like the following example:

    [...]
    " set the runtime path to include VUndle and initialize
    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()

    " let Vundle manage Vundle, required
    Plugin 'VundleVim/Vundle.vim'

    call vundle#end()
    [...]

Then you need to replace it with:

    [...]
    " Install vim-plug if we don't already have it
    if empty(glob('~/.vim/autoload/plug.vim'))
    silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
    endif

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

    call plug#end()
    [...]

We're not done yet, there is one more thing we need to do, we need to change our plugin list with Plug.

    Plugin 'preservim/nerdtree'    " <= this is for Vundle
    Plug 'preservim/nerdtree'      " <= this is for vim-plug

Save it, and restart your vim. After that, you can simply run :PlugInstall and it will automatically copying all the installed plugins from Vundle directory to vim-plug directory.

vimtext editor

Reading Time1 min



© Repodev - Muh Ibnu Habil Hanafi