Saturday, November 13, 2010

How to install NERD tree for Vim in Ubuntu

NERD tree is a Vim plugin to help the user navigate file directories from within Vim. For editing Rails applications, it's a must, because a Rails application is contained within many different folders. Download the latest .zip file from the NERD tree homepage. At the time of writing, that is 4.10.
  1. If you don't already have one, create a new folder called ".vim" in your home directory (.e.g /home/andy/.vim)
  2. Unzip the file NERD_tree.zip file to this new directory either by using Archive Manager or using the command line:
    1. (Archive Manager) Right click on the file NERD_tree.zip and select "Open with Archive Manager."
    2. Click on "Extract." In the "Location:" field, type ".vim". You have to type it because, as a folder with a dot prefix, it's hidden and won't show up in the GUI file selector.
    3. Click "Extract." You can leave all the default options as they are.
    1. (Command line) Move the file NERD_tree.zip to the .vim folder by typing: $ mv Downloads/NERD_tree.zip .vim The first argument (Downloads/NERD_tree.zip) gives the mv command the location and name of the file you wish to move, and the second argument (.vim) gives the location to which you'd like to move it.
    2. Navigate to the .vim directory: $ cd .vim
    3. Extract the archive: $ unzip NERD_tree
  3. Restart vim.
  4. Inside Vim, type :helptags /.vim/docs. This should enable you to type :help NERD_tree to see documentation.
  5. To use Nerd Tree, type :NERDTree from within Vim. Type :q to leave Nerd Tree.