Vim and plugins (NerdTree)
#98 Henry, Thursday, 31 March 2011 3:09 PM (Category: UNIX Tools)
(Tags: vim nerdtree)

I used Vi for a very long time. And then Vim was created, and I've been using Vim for a long time. I've got a .vimrc that suits my needs and I'm very effective with my use of Vim. I thought I was.

But I've been reading about Vim plugins, and I think I have missed out on a new area of Vim functionality. One plugin that is mentioned a lot is NerdTree - a plugin that allows you to navigate the directory tree and select files. I've managed okay over the years, remembering where my files are, keeping a mental model of my directory tree in my head and using tab completion to load the files I want. But sometimes I just want to be lazy and NerdTree sounds like a pleasant way to be lazy.

I went to install it and I had a lot of problems. I solved my problems eventually and these are my notes.

Because I was starting from scratch, I had to make these preliminary steps:

Then download the NerdTree plugin ( and install it.

It's now ready for use. To view the help for it, type

:help NERD_tree.txt

To run it, type


Because I'm lazy and don't want to type that much to start NerdTree, I added this to my .vimrc:

map t :NERDTree

and now I can just type and NerdTree will start.

A left pane will open with your directory tree displayed. There are a large number of commands. Press ? (as they advise you at the top) to see the list of commands available to you. You will find that some normal editing commands still work too, even if they aren't listed. It's a nice implementation.

The simplest subset of commands:

NERD Tree in action

Now there's a lot more plugins for me to experiment with.