Posts Tagged ‘ ubuntu ’

How to install nerdtree for vim using pathogen

Lately, I’ve been experimenting with vim because of many posts I’ve read about how productive of a coder you can become, once you’re used to all of the commands and shortcuts: here, here, and here.

When browsing the interwebs, I found that many people use a cool plugin called nerdtree to navigate between files quicker.  I started to try to install the plugin for vim and for me, it was difficult.  I’m running Ubuntu 12.04 and am relatively new to vim. So I’m going to share the process I went through to get it up and running.

Install Pathogen

I’ve found that if you install a vim plugin called pathogen, that it makes installing other plugins a lot easier.

First, you need to create the environment for pathogen by entering these commands into your terminal:

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

If that didn’t work for you, you will need to install curl by entering this into your terminal:

sudo apt-get install curl

if you are new to vim and do not have a .vimrc file, create one with vim:

vim ~/.vimrc

and paste the following lines to the end of your .vimrc file:

” Pathogen
execute pathogen#infect()
call pathogen#helptags() ” generate helptags for everything in ‘runtimepath’
syntax on
filetype plugin indent on

Now we’re ready to install nerdtree. (or any other vim plugin for that matter)

Install nerdtree

You can easily download and install nerdtree using this command:

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

Next, start a vim session and type

:help NERD_tree.txt

To toggle the directory listing between visible and hidden states use

:NERDTreeToggle

%d bloggers like this: