Using Vim with Pathogen

July 18, 2011 § 7 Comments

Vim is my editor of choice. Vim is everywhere and has hundreds of plugins to allow you to do pretty much anything a text editor can possibly do.

The problem is, setting up Vim to use plugins is not the simplest thing to do. Enter Pathogen.

Pathogen is written by Vim plugin guru Tim Pope, it lets you isolate plugin scripts under their own directories. This means easy installs, uninistalls and upgrades.

Here’s a walk through about how to get this up and running:

I always like to start things from a clean slate, so firstly backup anything you already have:

mv ~/.vimrc ~/.vimrc.bak
mv ~/.vim/ ~/.vimbak/

Next create a brand new .vim directory and download pathogen:

mkdir -p ~/.vim/autoload
mkdir -p ~/.vim/bundle
cd ~/.vim/autoload
curl https://github.com/tpope/vim-pathogen/raw/master/autoload/pathogen.vim > pathogen.vim

Now create a new ~/.vimrc and put the following lines at the top:

" Pathogen
filetype off " Pathogen needs to run before plugin indent on
call pathogen#runtime_append_all_bundles()
call pathogen#helptags() " generate helptags for everything in 'runtimepath'
filetype plugin indent on

That’s pretty much it.

Now for the payoff – git powered plugin management. As seems to be the case with most code these days, many vim plugins are hosted on Github

Let’s walk through installing the popular NERDTree plugin. This plugin gives Vim a Textmate style project drawer:

cd ~/.vim/bundle
git clone git://github.com/scrooloose/nerdtree.git

restart vim, and boom NerdTree is installed, do a :NERDTreeToggle to hide and show the project drawer. To uninstall just delete the cloned repo:

rm -Rf ~/.vim/bundle/nerdtree

Simples.

Here are some of the plugins I like:

  • Essential if you’re a Rails developer, allows switching between files, autocompletion, refactoring, and lots more.
    git clone git://github.com/tpope/vim-rails.git
  • Command-T Leader t (usually \t) for quickly finding files.
    git clone git://git.wincent.com/command-t.git
  • snipmate.vim TextMate-style snippets in Vim: type def and a Ruby method block gets created.
    git clone git://github.com/msanders/snipmate.vim.git
  • vividchalk.vim A colorscheme strangely reminiscent of Vibrant Ink for a certain OS X editor.
    git clone git://github.com/tpope/vim-vividchalk.git

Tagged: pathogen, vim

§ 7 Responses to Using Vim with Pathogen

Leave a Reply

What’s this?

You are currently reading Using Vim with Pathogen at Logical Friday.

meta

Follow

%d bloggers like this: