How do I close a folder in Sublime Text?
Solution 1
I'm using Sublime Text 3. Right click on the folder and then select "Remove folder from project". Guess you don't have it in the older versions.
Solution 2
If you have Package Control installed (and you definitely should!), take a look at the SideBarEnhancements
plugin. It adds a whole lot of extra functionality to the side bar, most of it accessible by the context (right-click) menu.
If you want to prevent certain folders from being viewed when you open a parent folder in the sidebar, use the "folder_exclude_patterns"
setting in your preferences. The default is
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],
but you could add anything you want, like "static"
, for example. If you do want to add something, make sure you copy all the values above as well if you want to continue excluding them.
Aside from that, I'm not really sure what you mean about "closing" a folder in the side bar. You can click on the little triangles to the left of the folder's name to expand or compress it, and in the context menu there's an option to Remove Folder from Project
if it's the root (highest level) one in the hierarchy. There is no way to "close" a folder in the manner you're describing (hiding it from view) in filesystem navigation programs like Windows Explorer, Finder, etc., so unfortunately I'm not sure what exactly you mean.
nmz787
Updated on July 09, 2022Comments
-
nmz787 almost 2 years
After opening Sublime Text 3, I chose to open a folder. This was a git repo, containing some folders that were static files which are cluttering up the folder list.
When I right-click on a folder, there is no 'close' option. The antonym of open is close, not delete, so I'm definitely not clicking that!
I've heard Sublime is very scriptable, is there some way I can add a close button to the right-click menu of the folder list?
edit: I just created a test directory structure: test/ test/testA/ test/testB/ test/testC/
opened the test folder from Sublime Text 3, then clicked delete from the right-click menu on testB, after clicking confirm or yes to confirm, I saw the directory WAS ACTUALLY DELETED, not deleted from Sublime's state. :(
-
skuroda over 10 yearsFor the sake of being thorough, there is also
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db", "*.sublime-workspace"]
-
nmz787 over 10 yearsIs there a 'hide folder' right-click option? If you can add explicit folders to
folder_exclude_patterns
(i.e."test/testB"
or"testB/"
Maybe a script add-on (I don't know how to do this) that keeps a session-only variable forfolder_exclude_patterns
(meaning they get go away when sublime closes, even if it crashes). Basically I just don't want to see certain folders in the side-bar, I don't want them collapsed or expanded (with the triangle), I just want them gone from view... some just clutter my navigation and I don't need to see them. -
Łukasz Siwiński almost 8 yearsWorks for Sublime Text 2 on Win10 too.