Hi everyone, I wanted to talk about NERDTree because I have seen it recommended in basically every Vim guide but I think if you want to be serious about improving productivity with Vim then using NERDTree is a mistake. I have paired with people who use it and when the directory tree pops up I know I need to sit back and relax for a few minutes and maybe catch up on my meditation.
These are the use cases for NERDTree as explained in the readme. I will cover them and suggest a faster, preexisting alternative.
This can be useful when you are first getting to know a project. But, the need for this would drop to zero pretty quickly as you become familiar. Some possible alternative ways to visually browse a directory:
lson the command line
- Vim's default directory browser that is available by opening a buffer on a directory.
find <path> | lessis available everywhere and the output can be learned fairly easily.
treecan be installed and outputs a traditional directory tree.
This I think is where workflows involving directory trees start taking a turn for the worse as you can get in the habit of using NERDTree all the time. Maybe not many people know this, but the Vim command mode comes with a splat and double splat operator that work well with tab completion to find and open files that you may not remember the exact location of.
For example, I see a class named
FooBar and by convention I know that it is probably in a file named something like
foo_bar. With the splat operators I can probably open the file with the following keystrokes:
This will generate a list of all files with
foo_bar in the name as tab completions. This takes usually a couple seconds as opposed to a minute or two navigating a complex file hierarchy in a tree.
I don't think I have ever seen other operations used, so I can't really comment. I think most people use other tools already. 🤷♂️
Thanks for your time. Let me know if there is some killer feature in NERDTree I missed or other alternatives in the comments.