315

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?

Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37
ZucchiniZe
  • 3,253
  • 3
  • 12
  • 6
  • 2
    http://stackoverflow.com/questions/2458398/packageplugin-management-for-vim – Ciro Santilli OurBigBook.com Oct 06 '15 at 11:32
  • 1
    Not an answer, but perhaps useful to consider: SpaceVim. – nilon Nov 26 '20 at 13:15
  • 2
    Bear in mind that Vim 8.0 now supports packages by default by installing the package to ~/.vim/pack/FOOBAR/start/PACKAGENAME, replacing FOOBAR with any directory name you like, and PACKAGENAME with the name of the package. See: https://vi.stackexchange.com/q/9522/7244 – Flimm Jan 13 '22 at 15:17

10 Answers10

211

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.

200_success
  • 9,549
  • 5
  • 51
  • 64
gjg
  • 2,242
  • 1
  • 11
  • 2
  • 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 Oct 22 '16 at 14:55
  • 15
    while I like vim-plug, be aware that it changes some vim defaults which you might find surprising/confusing https://github.com/junegunn/vim-plug/issues/379 – laktak Dec 12 '16 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\... – Stephen Jacob Jun 22 '18 at 08: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 May 27 '20 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 Mar 29 '21 at 14:42
77

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.

Hotschke
  • 4,740
  • 26
  • 37
muru
  • 24,838
  • 8
  • 82
  • 143
  • 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 Feb 05 '15 at 03: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 Feb 05 '15 at 03: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 Feb 09 '15 at 10:23
  • @jalanb Nice! I'll look into this an update when I can. – muru Feb 09 '15 at 10:37
  • 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. – Martin York Feb 10 '15 at 00:40
  • @LokiAstari Vundle and vim-plug have commands for updating plugins. Anything particular you were looking for? – muru Feb 10 '15 at 14:03
  • My personal experience is that Pathogen is the worst choice you have among so many good alternatives. If you manage your bundles as git submodules then you often have to deal with lots of updates that are irrelevant to the changes you make, which is quite messy. The other choices are just as minimal, from the user's perspective, let alone easier to use, as most of them manages bundles for you. Currently my preferred choice is vim-plug. – koo Feb 19 '15 at 17:03
  • What does If you like to get crazy mean ? Does pathogen#helptags() eat resources ? – JaDogg May 27 '15 at 04:13
  • 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 May 27 '15 at 04:35
  • I have been using vimogen for years (a package manager for Pathogen I wrote). It's menu based and simpler than using git submodules and keeps your plugin list outside of vimrc. – rkulla Jan 19 '21 at 04:29
67

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.

Rich
  • 31,891
  • 3
  • 72
  • 139
David
  • 671
  • 5
  • 2
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).

muru
  • 24,838
  • 8
  • 82
  • 143
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 ;-)

statox
  • 49,782
  • 19
  • 148
  • 225
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).

RSabet
  • 449
  • 4
  • 5
10

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.

Luc Hermitte
  • 17,351
  • 1
  • 33
  • 49
  • vim-plug's README has an example saying "Group dependencies". Have you tried that, or does it differ from VAM/NeoBundle's methods? – muru Feb 29 '16 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. – Luc Hermitte Feb 29 '16 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. – Luc Hermitte Feb 29 '16 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. – Peter V. Mørch Mar 27 '17 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.

genotrance
  • 219
  • 2
  • 1
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.

  • 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 Oct 06 '17 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 – Melanie Day Oct 06 '17 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. – Christian Brabandt Oct 07 '17 at 07: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
nrako
  • 119
  • 2
  • 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 Nov 12 '17 at 01:05