Skip to content
Charles Gueunet edited this page Oct 6, 2020 · 3 revisions

grep is a command-line utility for searching plain-text data sets for lines that match a regular expression.

rc/tools/grep.kak is a small wrapper around it.

When you use the kakoune's grep command, it populates a special *grep* buffer, listing all found occurrences. You can then use grep-next-match or grep-previous-match to navigate between them.

By default, kakoune will run grep -RHn in the background:

  • -R, --dereference-recursive Read all files under each directory, recursively. Follow all symbolic links
  • -H, --with-filename Print the file name for each match.
  • -n, --line-number Prefix each line of output with the 1-based line number within its input file

You can customize this value by setting the grepcmd option. For instance, you may want to to rely on a similar tool to do the job, such as Ag (The Silver Searcher), Ack or ripgrep:

set-option global grepcmd 'rg --column'

See also https://github.com/occivink/kakoune-find

Clone this wiki locally