Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently using NERDTree for browsing directories within Vim. One thing I miss from heftier IDEs (e.g. Eclipse) is the ability to browse in a flattened or "package" view of the directory structure, particularly when browsing Java or Python packages (for example).


Instead of this:


You can quickly get to any node that contains source without navigating the entire path to that source.

Anyone aware of a plugin or other way to accomplish this?

share|improve this question

Take a look at the Command-T plugin:

Here's the description from the developer:

The Command-T plug-in for VIM provides an extremely fast,
intuitive mechanism for opening files with a minimal number
of keystrokes. It's named "Command-T" because it is inspired
by the "Go to File" window bound to Command-T in TextMate.

Files are selected by typing characters that appear in their
paths, and are ordered by an algorithm which knows that
characters that appear in certain locations (for example,
immediately after a path separator) should be given more weight.

As you browse, files are presented in a flattened list, with full pathnames relative to the current directory:

To narrow the list of files, type characters from anywhere in the pathname. For example, dcb or bul are enough to specify demos/Colors/

Once you've typed enough of the pathname to find the file you want, just hit Enter to load it. (You don't have to get all the way to a single file; once you're close, you can use the arrow keys to select the one you want.)

Anyway, it's not exactly what you described, but it might be exactly what you want. :-)

share|improve this answer
I have installed this and am playing around with it. Will let you know what I think. I've already found myself trying to j,k to navigate the file listing. Colorsjjjjj, doh! – Joe Holloway Jul 7 '10 at 18:00
You'll be happy to learn that the plugin provides Control+J / Control+K for this very reason. :-) – Bill Odom Jul 8 '10 at 19:14


my apologies for an original answer that was completely incorrect. This revised version is much more possessed of logic.

You could do

:r !find -type d

and then put the cursor on the directory you're interested in and hit ^W-F to get a netrw window on that directory.

This is going to give you a listing of all directories, including ones that have subdirectories, though. It sounds like you just want to see the directories that don't have subdirectories.

So to filter it so it just shows 'leaf nodes', you could pipe it into another command. I suspect that there's a better way, but this should do it:

:r !find -type d | while read d; do if (( $(find "$d" -mindepth 1 -maxdepth 1 -type d | wc -l) == 0 )); then echo "$d"; fi; done

Basically it just goes through all subdirectories, and prints the ones that themselves do not have subdirectories. This is a pretty inefficient way to do this, but it should get you what (I think) you want.

I've never used NERDTree, so I can't tell you how that would integrate with it.. but that's how I'd do that. If you're using Windows, please disregard this advice.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .