如何强制ag在node_modules中查找匹配项?

mbl*_*ele 10 ag

我正在使用ag来搜索git repo.它在我的node_modules子目录下找不到匹配项.为什么不,我该如何控制这种行为?

mbl*_*ele 11

事实证明,.gitignore默认情况下,ag会尊重文件的内容.所以,如果node_modules进入.gitignore,ag将不会搜索它.这是所有明智的行为,但如果您不期待它,则难以调试.希望这篇文章能有所帮助.

最后有一个很好的总结man ag:

IGNORING FILES

   By default, ag will ignore files whose names match patterns in  .gitig-
   nore,  .hgignore,  or  .agignore.  These  files  can be anywhere in the
   directories being searched.  Ag  also  ignores  files  matched  by  the
   svn:ignore property if svn --version is 1.6 or older. Finally, ag looks
   in $HOME/.agignore for ignore patterns. Binary  files  are  ignored  by
   default as well.

   If  you want to ignore .gitignore, .hgignore, and svn:ignore, but still
   take .agignore into account, use -U.

   Use the -t option to search all text files; -a to search all files; and
   -u to search all, including hidden files.
Run Code Online (Sandbox Code Playgroud)

为了我的目的ag -t似乎运作良好.