Exclude node_modules from sublime search

Have you had a prob­lem 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?

Solu­tion 1

If you want to exclude a direc­tory from your search results, add this the fol­low­ing fil­ter in your query:

-*/name_of_dir/* 

For exam­ple, when you type the fol­low­ing 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 exclud­ing the node_modules and bower direc­tory. Note the sec­ond query uses a rel­a­tive path.


Solu­tion 2

To glob­ally exclude fold­ers from search results, put these set­tings in

sublime-preferences


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

You may also like...