Hacker News new | past | comments | ask | show | jobs | submit login
Vim Plug – A minimalist Vim plugin manager (github.com/junegunn)
81 points by bpierre on Sept 13, 2014 | hide | past | favorite | 48 comments

Yeah - why should a user switch over from Pathogen or Vundle? I'm not trying to be a jerk -- just suggesting that that explanation is probably worth giving.

The most obvious benefit I believe is its ability to update plugins in parallel. A GIF [1] shows that it managed to update 40 plugins in mere 4 seconds. The other notable point is that it allows you to load plugins on demand, which helps reducing the startup time greatly [2] if you happened to use many number of plugins. It also provides some other nice features that pathogen or vundle do not have while still being easy to use.

[1]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug...

[2]: http://junegunn.kr/images/vim-startup-time.png

You can do that with pathogen very easily. See my vimfiles repo: https://stealthis.ca/vimfiles.git/tree/bin/update

The biggest reason over Pathogen is automatic installation of your dependent plugins. Biggest reasons over Vundle is parallel downloading, dynamic plugin loading, and static plugins. (all of the reasons for me, YMMV)

I've found even that I can install vim-plug with only a few lines of vimscript so that I don't even need to store a .vim directory in my dotfiles repository. Everything can just be installed and run the first time I start vim on a machine, and I can easly :PlugUpdate to get updates to any of my installed plugins.

FWIW, this is also quite possible with Vundle. I keep my plugin management in a separate file which also contains the Vundle bootstrap logic for new systems. This stanza sets up Vundle if it isn't already installed...:


... and this one after the plugin definitions installs the remaining bundles:


(I haven't updated this to the new "Plugin" Vundle syntax yet; the change is local but not pushed.)

That said, features like vim-plug's postupdate hooks are sweet.

> See also pathogen

Indeed, vim-plug seems a very nice plugin manager, but it is in no way "more minimalist" than pathogen. How could one be?

Pathogen doesn't manage your plugins. You have to `git clone` (or submodule) and update them yourself.

It doesn't do those two things, but I don't think that's a compelling argument for why it doesn't manage plugins. I certainly use it to manage my plugins.

Don't forget neobundle [1], which I find more useful than either as it allows loading for specific filetypes and asynchronous plugin installation.

[1] https://github.com/Shougo/neobundle.vim

One I wasn't aware of. Thanks.

What is the use case for a Vim script manager? I've never understood what this offers over including a full .vim in your version-controlled dotfiles. With a script manager, you have to worry about repositories disappearing, Github being down, and also breaking changes (unless you want to track a SHA on each one).

With a simple .vim, your Vim configuration is a living, breathing thing, and you can easily modify any script you're using the moment you find a bug in it that interrupts your work: You own your vimfiles. When you manually upgrade a script, it's trivial to roll back to the last version that worked. I guess dotfiles are the last place I want to introduce needless indirection: They should represent my work environment at a point in time, precisely.

I can only see two benefits: The ability to try out new plugins quickly, and the ability to upgrade all of your plugins at once quickly. Are these worth sacrificing control over your editor config? This has puzzled me since the day tpope released Pathogen to much fanfare.

I did the whole single .vim in git before switching to a script manager and I consider it a huge improvement.

- It's easier to install a new plugin, no more unzipping and copying files manually.

- The files from different plugins don't get mixed up together anymore

- which mean is also easier to remove one

- and also no file name conflict.

- If I have a bug somewhere it's easier to disable each plugins temporarily to find which one cause it.

- Easier to update a plugin

- My modification to my .vim don't get mixed up with the upstream updates from the plugins. If I want to modify a plugin I just fork it (and try to have my modification merged)

- In fact I don't really have a .vim anymore, I put everything in my .vimrc which is a nicer to read centralized location. If some part become too big I just refactor it in a separate module that I install with the manager.

I don't get the benefits of a vim script manager vs using your distribution's package manager, which seems to cover most (it not all) of the above.

Which script manager did you settle on?

> Are these worth sacrificing control over your editor config?

You're not sacrificing any control. I'll speak only of the ones I know: vundle, neobundle, and vim-plug are using very basic Vim mechanisms to save you the hassle. Appending to &runtimepath is the Vim equivalent of modifying your shell $PATH.

And deferred loading, if you choose to use it (I don't), actually gives you more control over plugin behavior.

> You own your vimfiles

This is emacs mentality. I don't want to own (read: maintain) the plugins I use. If I find a bug, I send a PR upstream so others can benefit. If the bug is unforgivable I uninstall the plugin. (You can also pin to a specific SHA).

  > This is emacs mentality.
I think that plugin managers (further complexity in editor configuration) are Emacs mentality. See, ELPA. The approach I'm describing is how people maintained their vimfiles before plugin managers became popular.

New Vim users are told to use a plugin manager now if they want to install other users' scripts, and I believe that is a flawed approach to configuring a lightweight editor like Vim.

You couldn't be more wrong. Maybe if you have 4 plugins this is a workable strategy. What if you have 20 or 50. How on earth do you update any of them cleanly?

It's because of comments like this that I've reserved my opinion about Vim script managers, of all things, for many years. There's no "right" or "wrong," I favor a tightly integrated editor setup where I own my plugins. Further, I don't believe that reaching for a plugin every time you have a problem to solve is the best or only way to extend your editor. My .vim probably has 10-30 third-party script collections, but "upgrade all vim scripts" isn't something I've ever wished to do at the same time. I prefer to upgrade plugins that I know to be active projects after reviewing the changelog, and I do this about once a year.

Is it so hard to relate to the desire simplicity and control in editor config? It's one place where I want to keep the cognitive overhead as low as possible: No forking git repositories to fix a bug in somebody's indent script that's not been maintained since 2007.

Personally, I don't use a script manager, but my distro's package manager. That handles updating in a perfecly clean way.

You can always clone/fork the repositories of the plugins you're using. Having moved from a big repo for my .vim + .vimrc to Vundle, I appreciate the possibility of quickly adding and removing packages.

I just use git submodules for all bundles that I install.

You'd want to version-control your entire .vim/ directory, not just .vimrc. (Presumably .vim is where this stores plugins.)

Why have any package manager then?

Vim scripts are barely even packages! Package managers for operating systems and build dependencies? Certainly. Does everything need package management? Only a small subset of all vim scripts have any dependencies. Tim Pope was the first person I remember introducing a script dependency (tlib) and I thought it was a ridiculous decoration at the time. A good vim plugin should be self-contained, in my opinion.

I recognize that this is really a misgiving I have with the direction Vim is going, towards complexity (plugin managers, multithreaded implementations). NeoVim looks like the final push that makes Vim configuration and operation truly byzantine. Then everybody gets to pick between Emacs and VEmacs.

You have confused the inability (and frankly unwillingness) in the Vim community to add new features as the virtue of simplicity, while in fact, its the tail wagging the dog. Vim's source is an abomination of global variables, copy paste, and decades of hill climbing. Vim still maintains support for e.g. Amiga and probably a dozen different language bindings. It is Vim's byzantine implementation and not some philosophical purity that guides its development (or really lack thereof). There is nothing simple about it. This mess is NeoVim's raison d'etre.

> towards complexity (plugin managers, multithreaded implementations). NeoVim looks like the final push that makes Vim configuration and operation truly byzantine

There's nothing simple about the Vim source, but Neovim has cut it in half, and modularized it. The Neovim strategy is similar in spirit to a microkernel, or shell tools: let the Vim core operate on inputs, and let external tools (GUIs, plugins) operate on the outputs. Like `find . | grep -v foo | sort` involves three self-contained, well-defined tools.

> multithreaded implementations

Because blocking the UI thread for any kind of I/O network, process, file, whatever is such a great thing. Or even just syntax highlighting, which actually prevents you from being able to move your cursor in vim sometimes.

Vim's source code is an abomination, and Neovim is making it unquestionably better.

Sorry, I can't even feign concern about the state of Vim's source code. I'm a Vim user and plugin developer, not a Vim developer.

A single-threaded UI means I can easily tell what Vim is doing at any time. It means the editor never feels clunky because indexing or some other background activity is hogging resources. It also means I never get a "process is running" prompt like in IntelliJ or Emacs when I want to exit.

> It also means I never get a "process is running" prompt like in IntelliJ or Emacs when I want to exit.

No, instead you find that you can't :q - or type anything for that matter - because everything's frozen while vim is realising that the network drive is down, or you're waiting for the syntax highlighting to finish.

And then you hit control-C and resume editing. None of this is as dramatic as you describe, and syntax-highlight freezes aren't as common now with the improved highlighting algorithm in 7.4.

This is anything but minimalist.

Why do I need a slower plugin manager that requires editing .vimrc to enable/disable plugins, when a couple of simple shell commands is faster and less error prone?

  vimenable() { mv $VIM_DISABLED/$1 $VIM_BUNDLE }
  vimdisable() { mv $VIM_BUNDLE/$1 $VIM_DISABLED }
  vimupdate() { for p in $VIM_BUNDLE/*; do (cd $p; git pull); done }
The dependent plugin support is interesting but until all the plugins include a standard dependency spec, I have to do it manually anyway.

It's a single file. It works with or without the ruby-dependent parallel plugin installations and upgrades. It allows for plugins to be loaded only when they're needed (e.g. only for JS files). That's minimalist.

In case someone argues about parallel updates, you could do something along the lines of "parallel git pull < ls $VIM_BUNDLE". I'm nowhere near convinced to switch, especially because I keep my vim plugin space small.

This is exactly what I've been looking for in a Vim plugin manager.

1. Loading plugins as needed! I've been doing this manually in my Vim config, but this makes it way easier. 2. Custom dir names for plugins! I think I opened up an issue on Vundle a few years ago asking for this (I think) but this has it out of the box. 3. Install hooks! I can't even describe how happy this makes me.

I'll probably install this next time I'm at my Linux box.

I just tested this, the parallel updates and installs are fantastic, however, I have "YouCompleteMe" as a plugin, and it consistently fails to install, and when it tries it seriously lags out. Vim will freeze for 4 or so minutes, and it fails with an error "fatal: destination path '~/.vim/plugged/YouCompleteMe' already exists and is not an empty directory"

Something strange there. Trying to resolve it, I don't doubt that there is maybe something I neglected to do, but that's not a black mark on me, vundle has no trouble with this, and doesn't complicate it either.

So cool project, young project, if I can resolve the issue I'll definitely be using it.

edit: Wait a minute, miiiight just be YouCompleteMe.

Doing more testing!

edit2: noooope, vim-plug installed YouCompleteMe in such a way as to mess up the repository. Manual installations work fine.

As I answered in the issue [1] the problem is likely caused by the task timeout. Maybe vim-plug should delete the repo directory if timeout occurs during the installation. A workaround at the moment is to increase `g:plug_timeout` so that it never times out.

[1]: https://github.com/junegunn/vim-plug/issues/75#issuecomment-...

I'm always curious about vim but hardly use it beyond git commit messages and modifying files on a server. I'd be interested in getting better, but have an easier time setting up Sublime (and don't really have the time during the week to experiment).

I checked out vim plug and it seems really great, but is there a vim package manager that works similar to the package manager you can get in sublime? One that searches through available packages and allows you to install them that way?

> similar to the package manager you can get in sublime? One that searches through available packages

VAM[1] tries to. That is the only one I am aware of. But the list is managed manually, which in my opinion is always a bad idea.

I think the best hope for a MELPA-like vim plugin source is to use the vimawesome[2] API, but I'm not aware of any plugin manager that does so yet. vimawesome scrapes various sources and looks at publicly-available .vimrc files. This is a technical solution rather than a "human vigilance" solution. People want to post their vimrcs, so take advantage of that rather than trying to curate a massive list. Passive/organic is usually better than active/centralized[3].

[1] https://github.com/MarcWeber/vim-addon-manager

[2] http://vimawesome.com

[3] I know some people still have a soft spot for Yahoo directory, but whatever.

Why not NeoBundle? It's easy to use, has lazy-plugin-loading, and everything you could ever want that Pathogen/vundle doesn't have.


You might say it's not sufficiently minimalistic, but the parent really isn't either and I'd say the lazy-loading implementation has to be a point in the favour of minimalism for NeoBundle

FYI, vim-plug also supports lazy-loading and the interface is pretty simple and concise [1].

NeoBundle obviously has more features, most notably supporting VCS' other than git, while vim-plug tries to be simpler and easier to setup and use (being a single file, no boilerplate code [2]). So they have different perspectives and I wouldn't argue that one is better than the other. It really depends on personal tastes.

[1]: https://github.com/junegunn/vim-plug#on-demand-loading-of-pl...

[2]: https://github.com/junegunn/vim-plug#example-a-small-sensibl...

How does all these plugin managers deal with plugins which require manual tasks to be performed during installation, like CommanT's and YCM's compillation?

Also, is there any way to create different sets of plugins for different install types and environments? I would like to have a "light" install, with only necessary stuff, and a "full" install with that plus everything else.

I switched to vim-plug from Vundle a couple of weeks ago, and I'm in love. Lazy initialization and, if your vim is built with ruby, threaded plugin installations and upgrades. As a bonus, it's beautiful.

pyed, you are hellbanned.

Isn't telling people that they're hellbanned against the whole point of hellbanning?

HN uses the tool indiscriminately without any form of communication, on the assumption that everyone who would dare violate a HN conduct rule simply can not be reasoned with.

There are some people who really can't be reasoned with, but it's not everyone.

Not if that particular instance of hellbanning was unjustified.

That said, coherentpony may just be against hellbanning as a whole. I find it a tasteless tool myself.

looking good

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact