vim Extending Vim Pathogen


Example

vim-pathogen is a runtimepath manager created by Tim Pope to make it easy to install plugins and runtime files in their own private directories.

Installing Pathogen

  1. Put pathogen in ~/.vim/bundle (here with Git, but it's not mandatory):

    git clone https://github.com/tpope/vim-pathogen.git
    
  2. Add the following lines to the top of your .vimrc:

     " enable vim-pathogen
     runtime bundle/vim-pathogen/autoload/pathogen.vim
     execute pathogen#infect()
    
  • the runtime directive specifies the path to the autoload script of vim-pathogen;
  • execute pathogen#infect() initiates it.

Once initiated, Pathogen will automatically start a sweep through the folders in ~/.vim/bundle and load the plugin from each of them.

Using Pathogen

  1. Put the top-level directory of your plugin in ~/.vim/bundle/ to make it available next time you start Vim.
  2. Run :Helptags to index your new plugin's documentation.

Benefits

  • Each plugin resides in its own directory under ~/.vim/bundle/.
  • Your .vimrc stays clean from the configuration needed to load plugins.

The effort needed to "manage" a plugin is thus reduced to:

  • put its top-level directory under ~/.vim/bundle/ to install it,
  • replace its top-level directory to update it,
  • delete its top-level directory to uninstall it.

How you perform those three actions (manually, via an automation tool, with Git/Svn/Hg/whatever…) is completely up to you.