Last Updated: February 10, 2020
·
128.9K
· alexvpopov

Exclude a directory from searching in Sublime Text 2/3

If you want to exclude a directory from your search results, when searching in ST2, add this this filter:

-*/name_of_dir/*

So for example, in a Rails project, if I want to search for something in the app/ folder, but exclude the assets folder, I would write in the where field:

/Users/Username/Repositories/myapp/app,-*/assets/*

However, this is a bit tedious to do every time. This technique is suitable for excluding folders on per case bases. To globally exclude folders from search results and goto anything, put these settings in Packages/User/Preferences.sublime-settings:

  • ST2: "binary_file_patterns": ["name_of_folder/"]
  • ST3: "folder_exclude_patterns": ["name_of_folder"]