Sublime Forum

Exclude directory from Go To Anything



I use Go To Anything (Cmd+P) many times every day, but there are some system directories in my project. Is it possible to exclude several dirs from “Go To Anything”?


Exclude Folders from Go To Anything

From Preferences > Settings - Default:

[pre=#2A2A2A] // folder_exclude_patterns and file_exclude_patterns control which files
// are listed in folders on the side bar. These can also be set on a per-
// project basis.
“folder_exclude_patterns”: “.svn”, “.git”, “.hg”, “CVS”],
“file_exclude_patterns”: “.pyc", ".pyo”, “.exe", ".dll”, “.obj",".o”, “.a", ".lib”, “.so", ".dylib”, “.ncb", ".sdf”, “.suo", ".pdb”, “.idb", “.DS_Store”, ".class”, “.psd", ".db”],
// These files will still show up in the side bar, but won’t be included in
// Goto Anything or Find in Files
“binary_file_patterns”: “.jpg", ".jpeg”, “.png", ".gif”, “.ttf", ".tga”, “.dds", ".ico”, “.eot", ".pdf”, “.swf", ".jar”, “*.zip”],[/pre]

To override this, add it to Preferences > Settings - User.



This tip came in handy for me. I use the CTAGs package and was tired of getting results from .tags and .tags_sorted_by_file in my results. I added both of these files in my default settings exclude filter and solved it for all my project-wide searches. Thanks for the help!



is “binary_file_patterns” supposed to work on a per project basis?
im trying this

			"path": "/Users/vitalee/Projects/Test",
      "binary_file_patterns": "config/*.rb"]

i expected all .rb files in config to be filtered from goto list but they’re not.
shed some light please.



I would bet that “binary_file_patterns” is only applied to the filename portion, not the path, so you can’t use “config/*.rb” as a pattern. I’d love to be wrong or to hear another way, though; I have a similar problem, system directories that I want to be able to browse but that I don’t want to appear in Go To Anything.



Don’t bet much, because it works as expected when pattern is added in global or user settings file. :smile:
it’s just ignored on a project level.
created a topic on userecho
go and vote if you care



I wanted to add that this removes the matching files / folders from your whole project, not just from the search.

I can see a solid use case for wanting to remove something from the search, to make it easier to find things in lists, and not wanting to hide it from the project entirely.



Any updates on this? I like the new definitions feature but it lists all my backups as well.



any news on this ?

having the same option to ignore folders from the sidebar & also ignore from the go-to is dump.