Search and filter files by name/type
Published on Sep 7, 2021, by Junji Zhi
Use counsel-projectile-ag.
I like to bind it a common shortcut, like Super + f (or s-f), so that I can pass the universal argument with C-u to filter results.
Example: To search in CoffeeScript and Javascript files only:
- Press
C-u s-f - Type
--coffee --jsand press enter - Type search string and press enter
Ag is one of the things that, if you understand the command line options, it helps a lot. It has built-in multiple groups of file types. Run the command to find out: ag --list-file-types.
You can also filter files with pattern: -G erb