Searching text with ripgrep

Install

brew install ripgrep

Searching

Basic recursive search:

rg 'pattern'

Limit search to a file type:

rg -t clojure 'pattern'

List all supported file types:

rg --type-list

Follow symlinks:

rg -L 'pattern'

Context

Show N lines before and after each match:

rg -C 3 'pattern'

Show N lines before each match:

rg -B 3 'pattern'

Show N lines after each match:

rg -A 3 'pattern'