is there a way to always ignore a folder... in project view.
I have multiple apps in one repo and have 'node_modules' in each app
mainapp ├── microapp │ └── node_modules ├── microapp2 │ └── node_modules ├── index ├── config └── assets
I want to exclude from search the node_modules
folder when i search inside project in the above structure.
(2) Go to the "Settings" tab and Click "Exclude files and locations". Then, click "Browse". (3) Here, at this step, you can use either a file or a folder. Select a file or a folder and click OK.
Right click on the folder and then select "Remove folder from project".
If the project is a Web Site, Visual Studio excludes a file from the project by adding an extension ". exclude" to mark it as excluded. So all files will the extension ". exclude" will not be used in the project. ".
Go to the Settings menu and in the Preferences.sublime-settings
file for the user and add a new node to the json named folder_exclude_patterns
. In it, add the folders that you don't want to be displayed (in json array format).
Example:
{ // ... other settings "folder_exclude_patterns": ["node_modules", "another_folder"], }
If you want to exclude certain directory or file without hiding it from the sidebar, you can ignore the above solution and Add Exclude Filter
in the Where
section of the search bar. But you will have to specify it everytime you change the search directory.
Note: You might need to restart Sublime Text in order to see the changes, as mentioned by @Soferio
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With