counsel-ag: Ignore matches from files

Published on Sep 15, 2021, by Junji Zhi

ag supports the option --ignore PATTERN to ignore files/directories whose names match the pattern. We could find a way to pass this command option in as a prefix argument.

As mentioned in searching and filtering by file name, I like to bind (counsel-projectile-ag) to a common shortcut, Super + f (or s-f), so that I can pass the universal argument with C-u to filter results.

Example: To search coffee and ignore the matches in org and markdown files, I would do:

  1. Press C-u s-f
  2. Type --ignore *org --ignore *md
  3. Type search string coffee and press enter



 Share: