If you go to the Preferences menu and then select Settings, it will open a JSON file of all the settings and their default values. This file also serves as documentation for what the settings mean. Two of them are relevant here. Here's the snippet from the Settings JSON file (last verified in Sublime Text 4):
// 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", ".Trash", ".Trash-*"],
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", ".directory", "desktop.ini", "*.class", "*.psd", "*.db", "*.sublime-workspace"],
// 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"],
It says here that "folder_exclude_patterns"
hides it from the side bar, while "binary_file_patterns"
hides it from search (these "won't be included in Goto Anything or Find in Files"). So if you want to exclude it from both, you can open the User Settings file, which overrides the default settings, and add the following.
Note that the User Settings file is what you see and can edit in the right-hand pane when you go to Preferences --> Settings.
Anyway, add the following:
{
"folder_exclude_patterns": ["node_modules"],
"binary_file_patterns": ["*/node_modules/*"]
}
The two entries above are different because the former is a folder pattern while the latter is a file pattern.
folder_exclude_patterns
? – Counterword,<project filters>,-*/<DIR_NAME_TO_EXCLUDE>/
– Repugnance