Sublime Forum

Automatically Close an Opened Folder When Closing Files


This might not be a feature request since I wasn’t able to determine if Sublime has a setting for this.

What I would like: my workflow is to open folders until I get to the file I want, open it, work on it for awhile, then close it, as various files go in and out of relevance to the feature I’m working on.

In tandem, I also tend to close folders in the sidebar, if I’m not using them anymore.

I also tend to open one window per project, but 90% of the projects I work with on the daily are in a single master folder, and they’re getting numerous enough that it would be convenient to have one window with all of them in it.

So: what I would like, is if I close a file tab, and it’s the only file from a given folder, for Sublime to collapse the open folder for me, and any enclosing folders which also don’t have files open.

If I manually open a folder, it would stay open, this hook would only trigger when a file was closed.

I don’t imagine this would work as default behavior, because it would be surprising, but as a configurable option it would be a real help to me.