A very basic code example to achieve fuzzy search using a single grep would be:
(defun custom-counsel-function (str)
(let ((str (split-string str)))
(format "rg --max-columns 240 --with-filename --no-heading --line-number --color never '%s' | grep %s"
(car str) (cadr str))))
(defun custom-counsel (&optional initial-input)
"Call the \"locate\" shell command.
INITIAL-INPUT can be given as the initial minibuffer input."
(let ((default-directory (read-directory-name "Start search from directory: ")))
(ivy-read "Ripgrep: " #'custom-counsel-function
:action (lambda (file)
grep patterns can be entered by separating them using a single space. For sure there are nicer ways to achieve this, but it takes some more time to inspect the Ivy (or any other completion framework) API.
rg we find that this can be achieved using the
-g flag. Now neither
projectile-ripgrep nor the
ripgrep-regexp command allow you to pass arguments to
rg when called interactively (you can look at their definitions to see how they work).
counsel-rg of the swiper/Ivy package does allow for passing arguments, and an example of how to use it is given in its docstring (and probably there exist helm and possibly consult alternatives for this also).
For filtering on directory paths, be sure to read well the documentation after
man-page. For example, to filter for files that are located in some-path
dir-example/file.ext relative from your initial search directory, you could search for the following:
ripgrep-pattern -- -g dir*/*