searcheditorsublimetext3sublimetexttext-editor

How do I exclude a folder from search in sublime text 3 permanently?


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.


Solution

  • 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