Ripgrep is a fast search tool like
grep. It's mostly a drop-in replacement for
ag, also know as the Silver Searcher.
helm-ag is a fantastic package for Emacs that allows you to display search results in a buffer.
You can also jump to locations of matches. Despite the name,
helm-ag works with ripgrep (
rg) as well
Make Spacemacs use helm-project-do-ag directly when pressing
SPC /without preselecting the symbol under the cursor.
SPC f e dto bring up
(defun dotspacemacs/user-config () ;; .... (evil-leader/set-key "/" 'spacemacs/helm-project-do-ag))
Force ripgrep as search tool
SPC SPC customize-set-variable
Set value to
rg --vimgrep --no-heading --smart-case
SPC / should allow you to search in the current project.
You can prefix patterns with options
-G*.cljs -w time - search for the word "time" in all
-tclojure time - search for "time" in all
uno\ due\ tre - search for the string "uno duo tre"
-C5 foo - search for "foo" but show 5 lines of context before and after the match
(?:^|[^\w-])time(?:[^\w-]|$) - search for lisp-word "time", i.e. search for the full word "time"
while considering "-" to be a word characer
This is very useful, thanks!
One note - for anyone using
helm-projectile, if you switch to ripgrep, you may see the following errors when running
helm-projectile-ag(C-c p s s)
The issue is that
helm-projectileautomatically adds options like
ag. When it tries to send the same options to
rg(which doesn't have an
--ignoreoption), you get the following errors. This behavior currently is not configurable.
A workaround is to create a wrapper script that removes these options, named
Make sure that file is in your path, then change
rg-wrapper --vimgrep --no-heading --smart-case