Vinegar.vim: A Lightweight File Browser

Earlier this year I was at a Vim London meetup, and I was saying to Drew Neil that I didn't think file browsers were idiomatic. I've used NERD tree on and off, but sometimes I wonder if just getting used to netrw would be better.

Some of us need help visualising things, so viewing files in a tree can help get a handle on the structure of a project. The built in file browser will do this -- try pressing :e . then i to toggle the listing style. Despite this, the project drawer style approach used by modern IDEs and GUI editors seems more popular with Vim users, even though it's unnatural in Vim:

Split windows and the project drawer go together like oil and vinegar. I don't mean to say that you can combine them to create a delicious salad dressing. I mean that they don't mix well!

-- Drew Neil

Tim Pope created vinegar.vim in response to Drew's feelings on the topic of project drawers:

You know what netrw is, right? The built in directory browser? Well, vinegar.vim enhances netrw, partially in an attempt to mitigate the need for more disruptive "project drawer" style plugins.

The way it works is to bring up netrw whenever you press - in Normal mode. It has some tweaks over the standard netrw browser -- the help text at the top is hidden, so it feels cleaner.

That means browsing files feels more modal than a split window, which I quite like. I think it's worth trying out vinegar.vim if you think project drawers are weird, and just want to occasionally bring up a file browser to navigate around a project.

blog comments powered by Disqus