consult-ripgrep

consult-ripgrep

July 1, 2024 | seedling, permanent

tags
ripgrep, Consult

Summary #

  • Search for regular expression in files. Consult invokes Grep asynchronously, while you enter the

search term. After at least consult-async-min-input characters, the search gets started.

  • Consult splits the input string into two parts, if the first character is a punctuation character, like #.
    • For example #regexps#filter-string, is split at the second #. The string regexps is passed to Grep. Note that Consult transforms Emacs regular expressions to expressions understand by the search program. Always use Emacs regular expressions at the prompt.

#regexps#filter-string -> results #

  • The filter-string is passed to the fast Emacs filtering to further narrow down the list of matches. This is particularly useful if you are using an advanced completion style like orderless.

#regex1 regex2 -> results #

  • If you enter multiple regular expressions separated by space only lines matching all regular expressions(AND) are shown. In order to match space literally, escape the space with a backslash.
  • consult-grep supports preview. If the consult-project-function returns non-nil, consult-grep searches the current project directory. Otherwise the default-directory is searched. If consult-grep is invoked with prefix argument C-u M-s g, you can specify one or more comma-separated files and directories manually.

filter file types #

"--" allows you to pass ripgrep options Love this!

#find-term – -tpy # only in python files
#find-term – -Tpy # exclude python file
#find-term – -g *.py

ripgrep

with consult-ripgrep #org – -tpy


Links to this note

Go to random page

Previous Next