Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package(Plugin) Management for Vim

Emacs 24 looks like it will have a package manager. What package management options are there for Vim?

like image 971
ntimes Avatar asked Mar 16 '10 21:03

ntimes


People also ask

Can you install plugins for Vim?

Starting with Vim version 8, you can install plugins without the need for a package manager by using the default package management tool. You can place Vim plugins in the ~/. vim/pack/vendor/start/plugin_name directory. Note that the plugin_name folder name will vary from plugin to plugin.

How do you use Packadd?

Manual Loading ( opt/ ) We use packadd nerdtree because that's what the directory is called. If your directory is called nerdtree2 instead, then you need to run :packadd nerdtree2 . Now close and restart vim. :NERDTreeToggle works. You need to run packadd everytime you start Vim.


2 Answers

I am now using VimPlug for my own Vim setup, and I definitely recommend it. Installation is very simple, and it is fast, pretty and effective!

VimPlug video

I used to recommend Vundle in this answer. But Vundle is no longer maintained, and there are better alternatives.

like image 58
Jostein Avatar answered Sep 25 '22 00:09

Jostein


Plugin management for vim used to be a pain in the traditional way by spreading plugin files across the whole personal vim runtime directory, eg. ~/.vim for *nix system. Once a plugin is installed, it is hard to be updated because there is no easy way to remove the outdated plugin files which is a necessary step.

At the beginning, I'd like to list my personal requirements about how a fine plugin management tool should be:

  1. shall be written in pure VimL
  2. shall install plugins into their own directory
  3. shall autoload plugins when vim starts, nice to load as needed
  4. shall have a builtin method of installing, updating and removing plugins
  5. nice to have a builtin method of search needed plugins
  6. shall be able to declare needed plugins in a file
  7. nice to have dependency solving mechanism

There are lots of implementations out there(Vim-Scripts.org has a comprehensive summary of all the available tools), I will only talk about several major tools by their creating order.

vimball was the first attempt to solve the problem and actually had been a half-official solution that lots of plugins shipped with a *.vba package together for a long time. Combined with GetLatestVimScripts, this formed the traditional way for the vim plugin management.

Even though, the problem still remained until Tim Pope's pathogen(Github Repo), which places each plugin into its own directory and loads them at the startup by modifying the "rtp(runtimepath)" of the vim, showed up. This is great progress - combined with vim-scripts.org hosted by git/github and other tools(eg. vimmer), it forms the modern way of managing vim plugins. There are lots of articles and videos talking about this topic.

  • The Modern Vim Config with Pathogen
  • Synchronizing plugins with git submodules and pathogen

As a plugin that manage the plugins, pathogen is still missing some core functionalities like searching, install, updating and removing the plugins. As a result, VAM(Vim-Addon-Manager)(Github Repo) stepped out. VAM provides almost everything needed to be plugin manager: places plugin files in its own directory, loads plugins at vim startup, searching/installing/updating/removing plugins in ex command line, written in pure VimL, maintains its own plugins central info database, even resolves the plugin dependencies. It seems VAM should be the one that we need as a full-featured vim plugin manager, but from my point of view, the approach VAM takes is a little bit inelegant and sometimes over-designed. Though it is still a wonderful plugin and worth using.

Then, there came Tom Link's tplugin(Github Repo) which improved pathogen by having plugins only loaded when related commands or functions are called, similar to AsNeeded. Also, it has some sort of dependency solving mechanism which seems nice.

Finnaly, Gmarik created Vundle (Github Repo) which is a successor of Tim Pope's pathogen with inspiration from Ruby's Bundler, it provides a better user interface and additional management functionality. Vundle to Vim is much similar as Bundler to a Ruby Project. By having needed plugins declared in vimrc, vundle handles all the rest, including installing/updating and removing plugins, through the ex command line interface. Most importantly, vundle is implemented in pure VimL. With the help of vundle, managing vim configuration across several computers could be done with just a simple vimrc file. As a modern plugin management tool, vundle relies on Git and can install plugin directly from Github. Vundle also provides a fancy interactive interface for searching and installing plugins.

Vundle does not fully fulfill my requirements though, but it does head to the right direction, which seems to be a good start point for me.

  • Vundle the Bundler of Vim
  • Sane Vim Plugin Management

Here are a discussion and another comparison between vim plugin managers by VAM's author MarcWeber.

like image 45
weynhamz Avatar answered Sep 27 '22 00:09

weynhamz