Andrew's Digital Garden

Search by filetype with ripgrep/emacs

As emacs (at least, Doom) uses ripgrep under the hood, it's possible to use ripgrep config/args to specify file filtering.

To search by glob use -g: rg foo -g '*.tsx' To search by file type use -t: rg foo -t ts

To get a list of filetypes, you can use rg --file-type.

To pass the arguments in emacs, use a double dash -- to separate the command: foo -- -t ts. In emacs, using quotes for -g seems to not work

[[emacs]] [[shell]]

Search by filetype with ripgrep/emacs