317

I have been looking at the different package managers for Vim, and the one I decided to use is vim-plug.

However, I have seen others like pathogen and vundle, and I honestly don't know what the difference is.

Can someone give me a brief overview of the differences, so I can decide which works best for me?

3

10 Answers 10

212

vim-plug is a nice alternative to Vundle, it does things a bit different from a technical point of view which should make it faster (see this). It has most (or all?) of the features of Vundle.

  • Parallel update procedure for Vim with any of +ruby, +python, or Neovim. Falls back to sequential mode using Vimscript if none is available.
  • Lazy loading, for faster startup (see this).
  • Install plugins.
  • Update plugins.
  • Review / rollback updates.
  • Supports OSX, Linux & UNIX systems, and MS Windows.
  • Post-update hooks e.g. automatically recompile YCM

To start using it:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

And in your vimrc:

call plug#begin()
Plug 'tpope/vim-sensible'

" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
call plug#end()

Then give the command

:PlugInstall

to install the listed plugins.

5
  • 2
    Thanks for the recommendation; I've resisted loaders prior to this because I like my loadtimes zippy. The one non-obvious thing I had to research was :PlugInstall upon a new plugin; even the official docs obscure this a bit.
    – msw
    Commented Oct 22, 2016 at 14:55
  • 15
    while I like vim-plug, be aware that it changes some vim defaults which you might find surprising/confusing github.com/junegunn/vim-plug/issues/379
    – laktak
    Commented Dec 12, 2016 at 19:32
  • 1
    For Windows, vim has a folder vimversion number, such as vim81 for vim 8.1. In the first step when using curl ensure the folder is ..\vim81\autoload\.. and not ..\.vim\autoload\... Commented Jun 22, 2018 at 8:40
  • @StephenJacob That suggests you are installing something into the Vim installation dir (usually \Program Files (x86)\vim\vim81)...? That should never need to be touched. Everything should be installed into the user's vim tree (usually \Users\username\vimfiles...no version number embedded). That's the windows equivalent to ~/.vim.
    – B Layer
    Commented May 27, 2020 at 21:33
  • Just because I stumbled over this, the vimrc file needs to be .vimrc, if you put it unter ~/ (i.e. under your home directory)
    – user637338
    Commented Mar 29, 2021 at 14:42
76

Pathogen is simple. Essentially it just does:

  • autoload plugins from a folder
  • generate help tags for these plugins

Pros:

  • minimalist

Cons:

  • everything else done manually (installing, updating, removing, etc.)
  • no lazy loading

To install it download pathogen.vim to ~/.vim/autoload:

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

And add to your .vimrc:

call pathogen#infect()
call pathogen#helptags() "If you like to get crazy :)

If you don't like to get crazy, only call :Helptags when you need to.

Plugins are then added to ~/vim/bundle.

10
  • 29
    Just to be clear, pathogen is not a plugin manager. All it does is manage the runtimepath. That's it. Any plugins you add to ~/.vim/bundle (i.e. the default location, you can change this), it adds the plugin's files to vim's runtimepath so they are accessible. The manually installing, updating, removing is not really a con if you don't have that many plugins installed. Additionally, when updating plugins, you can choose to fetch only a subset of the changes, and not update to the latest version of a plugin, which gives you a lot of control.
    – akshay
    Commented Feb 5, 2015 at 3:24
  • 1
    @AkshayHegde Yes, once I started writing the Vundle answer I had to go back and edit out "plugin manager" from this answer. Seconded about the con, that's why I continue to use it instead of anything else.
    – muru
    Commented Feb 5, 2015 at 3:30
  • 1
    vim-pandemic is a nice addition to Pathogen. It handles the remote repositories behind the plugins, leaving Pathogen to handle the runtimepath. This does mean one needs two tools, but for disparate tasks which "should" be handled separately. The advantage of Pathogen + Pandemic that I found most convincing: there's no need to deal with git sub-modules for the bundles.
    – jalanb
    Commented Feb 9, 2015 at 10:23
  • 3
    I use pathogen as my plugin loader. But I use git submodules to control the versions of the individual plugins. So its minimalist approach works well for my use case. How do the other managers handle version-ing and plugin updates. Commented Feb 10, 2015 at 0:40
  • 3
    @JaDogg Oh, that's from the README: "Normally, Vim expects you to run :helptags on each directory with documentation (e.g., :helptags ~/.vim/doc). Provided with pathogen.vim is a :Helptags command that does this on every directory in your 'runtimepath'. If you really want to get crazy, you could even invoke Helptags in your vimrc. I don't like to get crazy." I'd say if you have a lot of plugins, this might slow down startup a bit. And you really don't need to run it at every startup, once for each plugin installation/upgrade should be enough.
    – muru
    Commented May 27, 2015 at 4:35
69

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 * is any name you want to use; e.g. .vim/pack/jimmy/start.

Clone your plugin into the start directory just as you would if you were using pathogen.

With Neovim, the directories are a little more longwinded:

.local/share/nvim/site/pack/*/start. From there do the same as for Vim.

There is no need at all for another plugin manager.

In Vim or Neovim, run :h packages for a little more detail. Read the part about colours because they are different, though not much. You need no extra instructions in your .vimrc or your nvim/init.vim files.

Hope that helps.

1
  • 3
    Neovim also loads packages in ~/.config/nvim/pack/*/start/
    – Flimm
    Commented Jan 13, 2022 at 15:39
54

Vundle is more complex. It is a package manager à la apt or yum for plugins. It can:

  • search a plugin index
  • update plugins
  • generate helptags automatically
  • keep, but not use, plugins in the autoload folder
  • clean out such unused plugins
  • Works on Linux, OSX, and MS Windows

To install:

git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

And then add to your .vimrc:

set nocompatible              " be iMproved, required
filetype off                  " required

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

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

" more Plugin commands
" ...
call vundle#end()            " required
filetype plugin indent on    " required

To install a plugin, use the Plugin command in .vimrc (more examples on the Github README):

" plugin on Github
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'

And then call :PluginInstall from .vim (or vim +PluginInstall +qall).

2
  • The NeoBundle README you have linked to says that project is now deprecated in favour of github.com/Shougo/dein.vim Commented Jun 23, 2016 at 2:44
  • @JonathanHartley the "dark"-powered one? I guess I should have seen that coming.
    – muru
    Commented Jun 23, 2016 at 5:36
23

dein.vim: As a follow up of this question, I'll add here the plugin manager made by the well-known Shougo.

According to the README, the plugin has the following dependencies:

  • Vim >7.4 or neovim: while keeping Vim up to date is a good thing, it may be problematic for some users that previous versions are not supported
  • git: which is pretty common for a package manager
  • rsync: which is not as common as git

The author claims that it is faster than NeoBundle. A benchmark can be found on the project's readme page.

One original concept of this plugin manager is that it does not provide any commands, but only functions: for example, to update your plugins you can't use something like :PlugUpdate, you'll have to call: :call dein#update(). To be honest I haven't found an explication of this design choice.

Also, someone created a plugin which provides these "missing" commands. I have no idea if this is a good idea or if this is against the main idea of the plugin manager but the author mentions it in the FAQ of the doc file.

Dein.vim supports getting plugins from Github (with a facilitated access to plugins from vimscript.org) and from local directories.

The plugin manager provides some classical features like updating and disabling the plugins. It also allows the execution of hooks at installation time.

Note that according to the FAQ, it seems you have to manually build the helptags of the plugins it installs.

An interesting point is that the author wants dein.vim to be easy to test and to maintain so the repository also contains some test scripts.

Finally, I'd say that this plugin manager seems to be designed to be lightweight and fast, which is interesting, but I think it is less user-friendly than vim-plug or Vundle, for example.


Oh, also, Shougo describes dein.vim as a "Dark powered Vim/Neovim plugin manager" if any one knows what it means, feel free to edit this answer: I'm curious ;-)

8
  • 1
    "Dark powered" is a phrase that you are going to find in Shougo's vim plugins that have support/or are only for NeoVim. Commented Sep 6, 2016 at 15:19
  • 19
    I think that phrase "Dark powered" comes from the "Light Vim users"- those who only use default features and "Dark Vim users"- those who try to use it as IDE or at least use a lot of plugins and have a lot of lines added to their vimrc file (more about it here in Shougo's presentation- slideshare.net/Shougo/lets-talk-about-neovim - slide 6)
    – lewiatan
    Commented Sep 12, 2016 at 8:56
  • 1
    @lewiatan: Thanks I think you get the right answer. (Interesting Shougo's presentation btw)
    – statox
    Commented Sep 12, 2016 at 9:14
  • 2
    @statox Shougo states: "Dein.vim also ditches command usage in favor of function calling, which may also contribute to performance(I’m not sure, though)." Commented Oct 17, 2016 at 15:24
  • 2
    Another Shougo's quote about the dark power of plugin, seems like @lewiatan was right :-) I think the plugins power is dark. So I am "Dark" Vim Master. Standard Vim developers are "Saint" Vim Master.
    – statox
    Commented Oct 24, 2016 at 12:40
13

I especially like VAM for its self-deployment: all you need is your .vimrc and then start vim.

So you don't need the To Install line used by most other plugin-managers (the first step of installing the plugin manager itself).

11

As far as I'm concerned, I want the plugin manager I use to support dependencies.

The reasons are that I'm maintaining several plugins and I have a lot of inter-dependencies : a generic library is used by all, the template/snippet engine is used by the C++ suite, the refactoring plugin uses also the ctags library-plugin, and so on. Requiring end-user to execute up to 10 lines to install the plugins they are interested in doesn't appear to me as a good solution.

So far, I only know of two such plugins: vim-addon-manager, and NeoBundle. VAM has forked its database code to vim-pi after many exchanges on vim official mailing list. The idea was that NeoBundle (and any other plugin interested in managing dependencies) could eventually exploit vim-pi.

I've recently came across vim-flavor that also handles dependencies. On the subject it checks plugin versions to install the right one.

Note: Since my initial answer,

  • NeoBundle development has stopped ;
  • and while vim-pi updates regularly its database from plugins on vim.org, and that VAM can still be used to express dependencies, it seems no longer possible to add alias to vim-pi database: MR/PR aren't merged anymore

AFAIK, none of these plugin clone/install/update plugins in background/parallel. As I don't install a new vim environment, nor update the plugins I've installed once a month, honestly, I don't care. They of course update 'helptags', take care of 'rtp', and so on.

4
  • vim-plug's README has an example saying "Group dependencies". Have you tried that, or does it differ from VAM/NeoBundle's methods?
    – muru
    Commented Feb 29, 2016 at 13:43
  • I've missed group dependencies in vim-plug documentation. I did see that they've removed their attempt to support dependencies from the code base however. Regarding group dependencies, I don't see how it can help. Dependencies should not be declared by the end user. They should be declared by the plugin writers. If you look at by lh-cpp plugin and look closely you'll see the dependencies are not something linear. It's an oriented graph, that need to be acyclic to avoid issues. Commented Feb 29, 2016 at 14:37
  • So far, I've been using VAM for more than a decade and I'm happy with it. Yet, I've used vim-flavor as it's much simpler to integrate from travis -- in order to test my plugins. And unfortunately, both use a different syntax to declare dependencies. Commented Feb 29, 2016 at 14:40
  • 2
    FYI: Development of NeoBundle has stopped (since Feb 23, 2016). It recommends its successor Dein.vim (by the same author) instead. Commented Mar 27, 2017 at 14:07
7

Most of these plugin managers do a great job of managing plugins but leave the headache of managing the vimrc to you. If you have multiple machines and want the same config across, Vire makes it super easy. You don't need git or figure out submodules or any extra effort to get setup or migrate.

  • Install Python, which is what most modern Vim plugins are written in and required anyway
  • pip install vire
  • Post your existing vimrc onto Github as a gist and maintain it there
  • If on Windows, vire -i to install the latest Vim or (Neovim with -i -n)
  • Remove any existing plugin function calls and define commented out calls to install any plugins " Plug 'tpope/vim-unimpaired'
  • vire gistID

Then run vire anytime you want your vimrc or plugins to be updated or with -i to update the app as well.

Vire leverages Vim / Neovim's pack feature to load plugins. You can also continue to use your existing plugin manager but use Vire to only install Vim, the vimrc, and the plugin manager itself if preferred.

4

For people who want a full plugin manager using Pathogen, there is also apt-vim. You can install it with curl -sL https://raw.githubusercontent.com/egalpin/apt-vim/master/install.sh | sh (as described here: https://www.linuxsecrets.com/1715-vi-editor-tips-trick-and-secrets-into-the-vi-vim-editor-part-ii ). Once installed, you can just type apt-vim install followed by the name of the package repository, similar to the Ubuntu apt package manager.

3
  • 1
    This is essentially a link-only answer. If you could go into a little more detail on how to install and use apt-vim, it would be acceptable.
    – Tumbler41
    Commented Oct 6, 2017 at 16:45
  • I updated it. Really I thought it should be a comment on the post about Pathogen, but I don't have enough points to make comments Commented Oct 6, 2017 at 22:55
  • 1
    Link missing to plugin. Also again a plugin that suggests curl URL |sh. I would never suggest anybody to run some random code from the Internet. Really that is a bad security habbit. Commented Oct 7, 2017 at 7:14
1

I was looking for a way to use pathogen but update easily and make it portable, so perhaps a bash script might be helpful (using vim-plug functionality)-

#!/bin/sh

# inspired by https://github.com/thoughtbot/dotfiles/blob/master/hooks/post-up

if [ ! -e "$HOME"/.vim/autoload/pathogen.vim ]; then
  curl -fLo "$HOME"/.vim/autoload/pathogen.vim --create-dirs \
      https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim
fi

if [ -e "$HOME"/.vim/autoload/plug.vim ]; then
  vim -E -s +PlugUpgrade +qa
else
  curl -fLo "$HOME"/.vim/autoload/plug.vim --create-dirs \
      https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
vim -u "$HOME"/.vimrc.bundles +PlugUpdate +PlugClean! +qa

And then an example .vimrc.bundle-

"installed via the Githubs
call plug#begin('~/.vim/bundle')
Plug 'bling/vim-airline'
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-fireplace'
Plug 'vim-scripts/paredit.vim'
" etc

call plug#end()

"disable vim-plug sugar-- actual config should be set via .vimrc
filetype plugin indent off 
syntax on
1
  • 2
    Can you add some details to this? The primary question OP poses is "Can someone give me a brief overview of the differences [in package managers] so I can decide which works best for me"? How does your submission help answer that? What are you adding to pathogen specifically that it doesn't have? That kind of thing.
    – B Layer
    Commented Nov 12, 2017 at 1:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.