bk90bw
Last Updated: October 16, 2018
·
87.78K
· 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"]

2 Responses
Add your response

29038

FYI inner wildcards do not appear to work for me. e.g. "folderexcludepatterns": ["/my/path/here//is/not//excluded/*"]

over 1 year ago ·
29236

Thanks for the tip! Very useful also for node projects. If you don't want to search in your project's dependencies, you can add "folderexcludepatterns": ["node_modules"]

over 1 year ago ·