By default ripgrep will:
- Honor your
.gitignoresettings. - Checks for additional ignore directives in
.ignore. - Does not process hidden files or directories.
- Does not follow symlinks.
These are the arguments I'm most likely to use.
-hfor brief help.--helpfor complete help.-ifor case insensitive searches.-Sfor smart case searches as in editors.-Fto search for a string instead of a regular expression.-wto treat the search string as if it was bracketed by\b.-gfor file globs to accept or reject(!).-.to include hidden files in the search.-Lto follow symbolic links.-M=###clips large lines to show ### columns.-max-columns-previewwith above shows a preview.-Cshow the context around the match.-cprints the names of files with matches and the number of matches in each file.--type {type}to search only files of a type.--type-not {type}to exclude files of a type.--type-listto see type to extension mappings.--statsfor analysis of your search.
By default the search string is evaluated as a regular expression. Normal shell conventions for quoting to avoid globbing work as expected.
$ ls
README.md
README.txt
readme.md
$ ls >bogus.txt
$ # search is a file glob:
$ rg readme.*
bogus.txt: readme.md
$ # search is a regular expression with globbing inhibited:
$ rg 'README.*'
bogus.txt: README.md
bogus.txt: README.txt
$ # search for a literal splat in golang files:
$ rg -F '*' --type go
...A configuration at ~/.ripgreprc of the one argument or
value per line format can override defaults if you do not
like the builtin defaults.
This will make searches case insensitive and adds a new filetype.
File .ignore:
-i
--type-add
'purebasic:*.{pb,pbi}'