• 0

Exclude node_modules from sublime search

Have you had a problem where you use Find And Replace at the root of your project inside the sublime text, and there are bunch of search results from node_modules, bower, which you don't care?

Solution 1

If you want to exclude a directory from your search results, add this the following filter in your query:
-*/name_of_dir/*
For example, when you type the following query as shown in the image
/PWD/<pr_root>, -*/bower/*, -*/node_modules/*
sublime-find It will search for helpers word inside the root of your project excluding the node_modules and bower directory. Note the second query uses a relative path.

Solution 2

To globally exclude folders from search results, put these settings in sublime-preferences

// Packages/User/Preferences.sublime-settings "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules", "bower", "coverage", "test-results"]