Searching Specific File Types in Emacs
If you’re using Emacs with consult-ripgrep (M-x consult-ripgrep), you might want to search only within certain file types—say, just .scala files in a project.
M-x consult-ripgrep RET -- -g '*.scala'
- The
--separates ripgrep (rg) options from the search term. -g '*.scala'tellsrgto search only in.scalafiles.- You can add multiple
-gflags for different file types:
M-x consult-ripgrep RET -- -g '*.scala' -g '*.sbt'