Settings

Theme

Ask HN: Setting to ignore /node_modules with find and grep

2 points by ereckers 10 years ago · 1 comment · 1 min read


Searching files in terminal and node_modules is making my life extremely uncomfortable.

Project directory looks like so:

   project/
   ├── index.html
   ├── node_modules
   ├── js/
   │   └── scripts.js
   └── style.css
I find myself using `find . | xargs grep "text string"` to search the project directory.

I want to ignore everything in node_modules all of the time.

I'm familiar with --prune and ignoring, etc.. but I want something like an alias in my .profile that ALWAYS ignores the contents of node_modules.

I've looked around, but I just don't know if I'm asking the question correctly.

Anyone have any solutions?

kspaans 10 years ago

Tried `git grep`? It's a nearly full grep, and will ignore things that aren't tracked in the repo.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection