revised code to be a bit cleaner, and changed to
ignore-case rather than
smart-case as the former is probably more transparent.
[edited original post, but also reproduced here:
(defun bms/org-roam-rg-search ()
"Search org-roam directory using consult-ripgrep. With live-preview."
(let ((consult-ripgrep-command "rg --null --ignore-case --type org --line-buffered --color=always --max-columns=500 --no-heading --line-number . -e ARG OPTS"))
(global-set-key (kbd "C-c rr") 'bms/org-roam-rg-search)
And here’s my initial attempt at a more deft-like version, which just returns one file match per term no matter how many hits are in the file. It doesn’t have the nice live-preview of the above function though:
(defun bms/consult-ripgrep-files-with-matches (&optional dir initial)
"Use consult-find style to return matches with \"rg --file-with-matches \". No live preview."
(let ((consult-find-command "rg --ignore-case --type org --files-with-matches . -e ARG OPTS"))
(consult-find dir initial)))
(defun bms/org-roam-rg-file-search ()
"Search org-roam directory using consult-find with \"rg --file-with-matches \". No live preview."
(global-set-key (kbd "C-c rf") 'bms/org-roam-rg-file-search)