Nerd Tree plugin can be activated by the :NERDTree vim command. It will open in vim as a new vertical split on the left:

Vim Nerd Tree

A screenshot of Nerd Tree plugin in action.

Here are the basics of how to use the plugin:

  • Use the natural vim navigation keys hjkl to navigate the files.
  • Press o to open the file in a new buffer or open/close directory.
  • Press t to open the file in a new tab.
  • Press i to open the file in a new horizontal split.
  • Press s to open the file in a new vertical split.
  • Press p to go to parent directory.
  • Press r to refresh the current directory.

All other keyboard shortcuts can be found by pressing ?. It will open a special help screen with the shortcut listings. Press ? again to get back to file tree.

To close the plugin execute the :NERDTreeClose command.

Typing :NERDTree and :NERDTreeClose all the time is really inconvenient. Therefore I have mapped the toggle command :NERDTreeToggle to the F2 key. This way I can quickly open and close Nerd Tree whenever I wish. You can also map it to F2 by putting map :NERDTreeToggle in your .vimrc file.

How to install nerd_tree.vim?

pathogen.vim is the recommended way to install nerdtree.

Installing Pathogen:

mkdir -p ~/.vim/autoload ~/.vim/bundle;
curl -Sso ~/.vim/autoload/pathogen.vim

Add following in ~/.vimrc (if this is not already there)

execute pathogen#infect() 
syntax on 
filetype plugin indent on

Installing nerdtree:

cd ~/.vim/bundle 
git clone

Add this again to ~/.vimrc

runtime 'bundle/nerdtree/plugin/NERD_tree.vim'
autocmd vimenter * NERDTree

Then reload vim, run :helptags ~/.vim/bundle/nerdtree/plugin/, and check out :help NERD_tree.txt.