A way to exclude folders from "Find in project"


#1

Hi,
every time I look for something with “Find in project”, it returns a thousands results because it search through my node_modules folder.

I’d like a way to remove that folder from the search.


#2

I think there’s no way to exclude folders yet.


#3

Hmm, weird, just tried again, and files in node_module doesn’t show up in the results, is node_modules listed in your gitignore?


#4

It is, but since I open a folder that contains a bunch of repositories, and not the repository itself, atom do not use any git related feature.

I should open one window for each repo then. Thank you


#5

Based on https://github.com/atom/find-and-replace/issues/149, seems like adding ! in front of the folder name will exclude the folder


#6

I found this works using Search in Directory, on the directory line, on OS X:

project_to_search_in, !node_modules, !.git


#7

Funny, I read the response from chandramuralis, and thought, gee why would I have to rename my folders to add an ! to the front of the folder name? That’s just dumb and won’t work for me…

Nicerr: The fact that you offered a concrete example makes it quite clear. Good job on communicating with others. thanks. This is a huge time saver for anybody working on a complex .meteor project. (and reminder to other users: don’t forget the comma!)


#8

As a workaround, I added “node_modules” in the config.cson file under .atom folder, in the section ignoredNames.
To find this file, under atom preferences, click on the button Open config folder.


#9

Or an easier way to do the same thing is to:

  1. Launch Atom
  2. Open the Settings View using Cmd+, on macOS or Ctrl+, on other platforms
  3. Go to the Core Settings section
  4. Find the “Ignored Names” setting and add an item to the list

Hand-editing the config.cson can be problematic because if you don’t get the formatting right, it can mess up your configuration. It’s much easier to let Atom worry about the formatting and just edit through the UI.


#10

If you need know the path/glob pattern to a specific directory to add to this ignore field, right-click the folder in the tree view and hit Search in Directory. Then copy in the glob pattern that appears in the bottom field of the search pane that appears. (I’ve had prior trouble getting the right pattern to match.)


#11

in the third input field type in:

!node_modules

:slight_smile:


#12

@nicerr
Your hint helped me a lot.
Working on linux, the only thing I had to adapt in order to exclude html files in the search result, was to include an asterisk like this:

project_to_search_in, !*.html