\flag{glob} flag case insensitively. This effectively treats \flag{glob} as \flag{iglob}. headingno-headingPrint matches grouped by each file. This flag prints the file path above clusters of matches from each file instead of printing the file path as a prefix for each matched line. .sp This is the default mode when printing to a tty. .sp When \fBstdout\fP is not a tty, then ripgrep will default to the standard grep-like format. One can force this format in Unix-like environments by piping the output of ripgrep to \fBcat\fP. For example, \fBrg\fP \fIfoo\fP \fB| cat\fP. helpShow help output. This flag prints the help output for ripgrep. .sp Unlike most other flags, the behavior of the short flag, \fB\-h\fP, and the long flag, \fB\-\-help\fP, is different. The short flag will show a condensed help output while the long flag will show a verbose help output. The verbose help output has complete documentation, where as the condensed help output will show only a single line for every flag. hiddenno-hiddenSearch hidden files and directories. Search hidden files and directories. By default, hidden files and directories are skipped. Note that if a hidden file or a directory is whitelisted in an ignore file, then it will be searched even if this flag isn't provided. Similarly if a hidden file or directory is given explicitly as an argument to ripgrep. .sp A file or directory is considered hidden if its base name starts with a dot character (\fB.\fP). On operating systems which support a "hidden" file attribute, like Windows, files with this attribute are also considered hidden. hostname-binCOMMANDRun a program to get this system's hostname. This flag controls how ripgrep determines this system's hostname. The flag's value should correspond to an executable (either a path or something that can be found via your system's \fBPATH\fP environment variable). When set, ripgrep will run this executable, with no arguments, and treat its output (with leading and trailing whitespace stripped) as your system's hostname. .sp When not set (the default, or the empty string), ripgrep will try to automatically detect your system's hostname. On Unix, this corresponds to calling \fBgethostname\fP. On Windows, this corresponds to calling \fBGetComputerNameExW\fP to fetch the system's "physical DNS hostname." .sp ripgrep uses your system's hostname for producing hyperlinks. hyperlink-formatFORMATSet the format of hyperlinks. Set the format of hyperlinks to use when printing results. Hyperlinks make certain elements of ripgrep's output, such as file paths, clickable. This generally only works in terminal emulators that support OSC-8 hyperlinks. For example, the format \fBfile://{host}{path}\fP will emit an RFC 8089 hyperlink. To see the format that ripgrep is using, pass the \flag{debug} flag. .sp Alternatively, a format string may correspond to one of the following aliases: \fBdefault\fP, \fBnone\fP, \fBfile\fP, \fBgrep+\fP, \fBkitty\fP, \fBmacvim\fP, \fBtextmate\fP, \fBvscode\fP, \fBvscode-insiders\fP, \fBvscodium\fP. The alias will be replaced with a format string that is intended to work for the corresponding application. .sp The following variables are available in the format string: .sp .TP 12 \fB{path}\fP Required. This is replaced with a path to a matching file. The path is guaranteed to be absolute and percent encoded such that it is valid to put into a URI. Note that a path is guaranteed to start with a /. .TP 12 \fB{host}\fP Optional. This is replaced with your system's hostname. On Unix, this corresponds to calling \fBgethostname\fP. On Windows, this corresponds to calling \fBGetComputerNameExW\fP to fetch the system's "physical DNS hostname." Alternatively, if \flag{hostname-bin} was provided, then the hostname returned from the output of that program will be returned. If no hostname could be found, then this variable is replaced with the empty string. .TP 12 \fB{line}\fP Optional. If appropriate, this is replaced with the line number of a match. If no line number is available (for example, if \fB\-\-no\-line\-number\fP was given), then it is automatically replaced with the value 1. .TP 12 \fB{column}\fP Optional, but requires the presence of \fB{line}\fP. If appropriate, this is replaced with the column number of a match. If no column number is available (for example, if \fB\-\-no\-column\fP was given), then it is automatically replaced with the value 1. .TP 12 \fB{wslprefix}\fP Optional. This is a special value that is set to \fBwsl$/\fP\fIWSL_DISTRO_NAME\fP, where \fIWSL_DISTRO_NAME\fP corresponds to the value of the equivalent environment variable. If the system is not Unix or if the \fIWSL_DISTRO_NAME\fP environment variable is not set, then this is replaced with the empty string. .PP A format string may be empty. An empty format string is equivalent to the \fBnone\fP alias. In this case, hyperlinks will be disabled. .sp At present, ripgrep does not enable hyperlinks by default. Users must opt into them. If you aren't sure what format to use, try \fBdefault\fP. .sp Like colors, when ripgrep detects that stdout is not connected to a tty, then hyperlinks are automatically disabled, regardless of the value of this flag. Users can pass \fB\-\-color=always\fP to forcefully emit hyperlinks. .sp Note that hyperlinks are only written when a path is also in the output and colors are enabled. To write hyperlinks without colors, you'll need to configure ripgrep to not colorize anything without actually disabling all ANSI escape codes completely: .sp .EX \-\-colors 'path:none' \\ \-\-colors 'line:none' \\ \-\-colors 'column:none' \\ \-\-colors 'match:none' .EE .sp ripgrep works this way because it treats the \flag{color} flag as a proxy for whether ANSI escape codes should be used at all. This means that environment variables like \fBNO_COLOR=1\fP and \fBTERM=dumb\fP not only disable colors, but hyperlinks as well. Similarly, colors and hyperlinks are disabled when ripgrep is not writing to a tty. (Unless one forces the issue by setting \fB\-\-color=always\fP.) .sp If you're searching a file directly, for example: .sp .EX rg foo path/to/file .EE .sp then hyperlinks will not be emitted since the path given does not appear in the output. To make the path appear, and thus also a hyperlink, use the \flag{with-filename} flag. .sp For more information on hyperlinks in terminal emulators, see: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda iglobInclude/exclude paths case insensitively. Include or exclude files and directories for searching that match the given glob. This always overrides any other ignore logic. Multiple glob flags may be used. Globbing rules match \fB.gitignore\fP globs. Precede a glob with a \fB!\fP to exclude it. If multiple globs match a file or directory, the glob given later in the command line takes precedence. Globs used via this flag are matched case insensitively. ignore-caseCase insensitive search. When this flag is provided, all patterns will be searched case insensitively. The case insensitivity rules used by ripgrep's default regex engine conform to Unicode's "simple" case folding rules. .sp This is a global option that applies to all patterns given to ripgrep. Individual patterns can still be matched case sensitively by using inline regex flags. For example, \fB(?\-i)abc\fP will match \fBabc\fP case sensitively even when this flag is used. .sp This flag overrides \flag{case-sensitive} and \flag{smart-case}. ignore-filePATHSpecify additional ignore files. Specifies a path to one or more \fBgitignore\fP formatted rules files. These patterns are applied after the patterns found in \fB.gitignore\fP, \fB.rgignore\fP and \fB.ignore\fP are applied and are matched relative to the current working directory. Multiple additional ignore files can be specified by using this flag repeatedly. When specifying multiple ignore files, earlier files have lower precedence than later files. .sp If you are looking for a way to include or exclude files and directories directly on the command line, then use \flag{glob} instead. ignore-file-case-insensitiveno-ignore-file-case-insensitiveProcess ignore files case insensitively. Process ignore files (\fB.gitignore\fP, \fB.ignore\fP, etc.) case insensitively. Note that this comes with a performance penalty and is most useful on case insensitive file systems (such as Windows). include-zerono-include-zeroInclude zero matches in summary output. When used with \flag{count} or \flag{count-matches}, this causes ripgrep to print the number of matches for each file even if there were zero matches. This is disabled by default but can be enabled to make ripgrep behave more like grep. invert-matchno-invert-matchInvert matching. This flag inverts matching. That is, instead of printing lines that match, ripgrep will print lines that don't match. .sp Note that this only inverts line-by-line matching. For example, combining this flag with \flag{files-with-matches} will emit files that contain any lines that do not match the patterns given. That's not the same as, for example, \flag{files-without-match}, which will emit files that do not contain any matching lines. jsonno-jsonShow search results in a JSON Lines format. Enable printing results in a JSON Lines format. .sp When this flag is provided, ripgrep will emit a sequence of messages, each encoded as a JSON object, where there are five different message types: .sp .TP 12 \fBbegin\fP A message that indicates a file is being searched and contains at least one match. .TP 12 \fBend\fP A message the indicates a file is done being searched. This message also include summary statistics about the search for a particular file. .TP 12 \fBmatch\fP A message that indicates a match was found. This includes the text and offsets of the match. .TP 12 \fBcontext\fP A message that indicates a contextual line was found. This includes the text of the line, along with any match information if the search was inverted. .TP 12 \fBsummary\fP The final message emitted by ripgrep that contains summary statistics about the search across all files. .PP Since file paths or the contents of files are not guaranteed to be valid UTF-8 and JSON itself must be representable by a Unicode encoding, ripgrep will emit all data elements as objects with one of two keys: \fBtext\fP or \fBbytes\fP. \fBtext\fP is a normal JSON string when the data is valid UTF-8 while \fBbytes\fP is the base64 encoded contents of the data. .sp The JSON Lines format is only supported for showing search results. It cannot be used with other flags that emit other types of output, such as \flag{files}, \flag{files-with-matches}, \flag{files-without-match}, \flag{count} or \flag{count-matches}. ripgrep will report an error if any of the aforementioned flags are used in concert with \flag{json}. .sp Other flags that control aspects of the standard output such as \flag{only-matching}, \flag{heading}, \flag{replace}, \flag{max-columns}, etc., have no effect when \flag{json} is set. However, enabling JSON output will always implicitly and unconditionally enable \flag{stats}. .sp A more complete description of the JSON format used can be found here: \fIhttps://docs.rs/grep-printer/*/grep_printer/struct.JSON.html\fP. line-bufferedno-line-bufferedForce line buffering. When enabled, ripgrep will always use line buffering. That is, whenever a matching line is found, it will be flushed to stdout immediately. This is the default when ripgrep's stdout is connected to a tty, but otherwise, ripgrep will use block buffering, which is typically faster. This flag forces ripgrep to use line buffering even if it would otherwise use block buffering. This is typically useful in shell pipelines, for example: .sp .EX tail -f something.log | rg foo --line-buffered | rg bar .EE .sp This overrides the \flag{block-buffered} flag. line-numberShow line numbers. Show line numbers (1-based). .sp This is enabled by default when stdout is connected to a tty. .sp This flag can be disabled by \flag{no-line-number}. no-line-numberSuppress line numbers. Suppress line numbers. .sp Line numbers are off by default when stdout is not connected to a tty. .sp Line numbers can be forcefully turned on by \flag{line-number}. line-regexpShow matches surrounded by line boundaries. When enabled, ripgrep will only show matches surrounded by line boundaries. This is equivalent to surrounding every pattern with \fB^\fP and \fB$\fP. In other words, this only prints lines where the entire line participates in a match. .sp This overrides the \flag{word-regexp} flag. max-columnsOmit lines longer than this limit. When given, ripgrep will omit lines longer than this limit in bytes. Instead of printing long lines, only the number of matches in that line is printed. .sp When this flag is omitted or is set to \fB0\fP, then it has no effect. max-columns-previewno-max-columns-previewShow preview for lines exceeding the limit. Prints a preview for lines exceeding the configured max column limit. .sp When the \flag{max-columns} flag is used, ripgrep will by default completely replace any line that is too long with a message indicating that a matching line was removed. When this flag is combined with \flag{max-columns}, a preview of the line (corresponding to the limit size) is shown instead, where the part of the line exceeding the limit is not shown. .sp If the \flag{max-columns} flag is not set, then this has no effect. max-countLimit the number of matching lines. Limit the number of matching lines per file searched to \fINUM\fP. .sp Note that \fB0\fP is a legal value but not likely to be useful. When used, ripgrep won't search anything. max-depthmaxdepth