aia 0.0.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1163 @@
1
+ # lib/aia/external/rg.rb
2
+
3
+ class AIA::External::Rg < AIA::External::Tool
4
+ def initialize
5
+ super
6
+ @role = :search
7
+ @desc = "Search tool like grep and The Silver Searcher"
8
+ @url = "https://github.com/BurntSushi/ripgrep"
9
+ end
10
+
11
+ def command(search_term, options = {})
12
+ rg_command = "rg --color=always --line-number --no-heading --smart-case #{search_term}"
13
+ "#{rg_command} | fzf #{options[:fzf_options]}"
14
+ end
15
+ end
16
+
17
+ __END__
18
+
19
+ ripgrep 13.0.0
20
+ Andrew Gallant <jamslam@gmail.com>
21
+
22
+ ripgrep (rg) recursively searches the current directory for a regex pattern.
23
+ By default, ripgrep will respect gitignore rules and automatically skip hidden
24
+ files/directories and binary files.
25
+
26
+ Use -h for short descriptions and --help for more details.
27
+
28
+ Project home page: https://github.com/BurntSushi/ripgrep
29
+
30
+
31
+ USAGE:
32
+ rg [OPTIONS] PATTERN [PATH ...]
33
+ rg [OPTIONS] -e PATTERN ... [PATH ...]
34
+ rg [OPTIONS] -f PATTERNFILE ... [PATH ...]
35
+ rg [OPTIONS] --files [PATH ...]
36
+ rg [OPTIONS] --type-list
37
+ command | rg [OPTIONS] PATTERN
38
+ rg [OPTIONS] --help
39
+ rg [OPTIONS] --version
40
+
41
+ ARGS:
42
+ <PATTERN>
43
+ A regular expression used for searching. To match a pattern beginning with a
44
+ dash, use the -e/--regexp flag.
45
+
46
+ For example, to search for the literal '-foo', you can use this flag:
47
+
48
+ rg -e -foo
49
+
50
+ You can also use the special '--' delimiter to indicate that no more flags
51
+ will be provided. Namely, the following is equivalent to the above:
52
+
53
+ rg -- -foo
54
+
55
+ <PATH>...
56
+ A file or directory to search. Directories are searched recursively. File paths
57
+ specified on the command line override glob and ignore rules.
58
+
59
+ OPTIONS:
60
+ -A, --after-context <NUM>
61
+ Show NUM lines after each match.
62
+
63
+ This overrides the --context and --passthru flags.
64
+
65
+ --auto-hybrid-regex
66
+ DEPRECATED. Use --engine instead.
67
+
68
+ When this flag is used, ripgrep will dynamically choose between supported regex
69
+ engines depending on the features used in a pattern. When ripgrep chooses a
70
+ regex engine, it applies that choice for every regex provided to ripgrep (e.g.,
71
+ via multiple -e/--regexp or -f/--file flags).
72
+
73
+ As an example of how this flag might behave, ripgrep will attempt to use
74
+ its default finite automata based regex engine whenever the pattern can be
75
+ successfully compiled with that regex engine. If PCRE2 is enabled and if the
76
+ pattern given could not be compiled with the default regex engine, then PCRE2
77
+ will be automatically used for searching. If PCRE2 isn't available, then this
78
+ flag has no effect because there is only one regex engine to choose from.
79
+
80
+ In the future, ripgrep may adjust its heuristics for how it decides which
81
+ regex engine to use. In general, the heuristics will be limited to a static
82
+ analysis of the patterns, and not to any specific runtime behavior observed
83
+ while searching files.
84
+
85
+ The primary downside of using this flag is that it may not always be obvious
86
+ which regex engine ripgrep uses, and thus, the match semantics or performance
87
+ profile of ripgrep may subtly and unexpectedly change. However, in many cases,
88
+ all regex engines will agree on what constitutes a match and it can be nice
89
+ to transparently support more advanced regex features like look-around and
90
+ backreferences without explicitly needing to enable them.
91
+
92
+ This flag can be disabled with --no-auto-hybrid-regex.
93
+
94
+ -B, --before-context <NUM>
95
+ Show NUM lines before each match.
96
+
97
+ This overrides the --context and --passthru flags.
98
+
99
+ --binary
100
+ Enabling this flag will cause ripgrep to search binary files. By default,
101
+ ripgrep attempts to automatically skip binary files in order to improve the
102
+ relevance of results and make the search faster.
103
+
104
+ Binary files are heuristically detected based on whether they contain a NUL
105
+ byte or not. By default (without this flag set), once a NUL byte is seen,
106
+ ripgrep will stop searching the file. Usually, NUL bytes occur in the beginning
107
+ of most binary files. If a NUL byte occurs after a match, then ripgrep will
108
+ still stop searching the rest of the file, but a warning will be printed.
109
+
110
+ In contrast, when this flag is provided, ripgrep will continue searching a file
111
+ even if a NUL byte is found. In particular, if a NUL byte is found then ripgrep
112
+ will continue searching until either a match is found or the end of the file is
113
+ reached, whichever comes sooner. If a match is found, then ripgrep will stop
114
+ and print a warning saying that the search stopped prematurely.
115
+
116
+ If you want ripgrep to search a file without any special NUL byte handling at
117
+ all (and potentially print binary data to stdout), then you should use the
118
+ '-a/--text' flag.
119
+
120
+ The '--binary' flag is a flag for controlling ripgrep's automatic filtering
121
+ mechanism. As such, it does not need to be used when searching a file
122
+ explicitly or when searching stdin. That is, it is only applicable when
123
+ recursively searching a directory.
124
+
125
+ Note that when the '-u/--unrestricted' flag is provided for a third time, then
126
+ this flag is automatically enabled.
127
+
128
+ This flag can be disabled with '--no-binary'. It overrides the '-a/--text'
129
+ flag.
130
+
131
+ --block-buffered
132
+ When enabled, ripgrep will use block buffering. That is, whenever a matching
133
+ line is found, it will be written to an in-memory buffer and will not be
134
+ written to stdout until the buffer reaches a certain size. This is the default
135
+ when ripgrep's stdout is redirected to a pipeline or a file. When ripgrep's
136
+ stdout is connected to a terminal, line buffering will be used. Forcing block
137
+ buffering can be useful when dumping a large amount of contents to a terminal.
138
+
139
+ Forceful block buffering can be disabled with --no-block-buffered. Note that
140
+ using --no-block-buffered causes ripgrep to revert to its default behavior of
141
+ automatically detecting the buffering strategy. To force line buffering, use
142
+ the --line-buffered flag.
143
+
144
+ -b, --byte-offset
145
+ Print the 0-based byte offset within the input file before each line of output.
146
+ If -o (--only-matching) is specified, print the offset of the matching part
147
+ itself.
148
+
149
+ If ripgrep does transcoding, then the byte offset is in terms of the the result
150
+ of transcoding and not the original data. This applies similarly to another
151
+ transformation on the source, such as decompression or a --pre filter. Note
152
+ that when the PCRE2 regex engine is used, then UTF-8 transcoding is done by
153
+ default.
154
+
155
+ -s, --case-sensitive
156
+ Search case sensitively.
157
+
158
+ This overrides the -i/--ignore-case and -S/--smart-case flags.
159
+
160
+ --color <WHEN>
161
+ This flag controls when to use colors. The default setting is 'auto', which
162
+ means ripgrep will try to guess when to use colors. For example, if ripgrep is
163
+ printing to a terminal, then it will use colors, but if it is redirected to a
164
+ file or a pipe, then it will suppress color output. ripgrep will suppress color
165
+ output in some other circumstances as well. For example, if the TERM
166
+ environment variable is not set or set to 'dumb', then ripgrep will not use
167
+ colors.
168
+
169
+ The possible values for this flag are:
170
+
171
+ never Colors will never be used.
172
+ auto The default. ripgrep tries to be smart.
173
+ always Colors will always be used regardless of where output is sent.
174
+ ansi Like 'always', but emits ANSI escapes (even in a Windows console).
175
+
176
+ When the --vimgrep flag is given to ripgrep, then the default value for the
177
+ --color flag changes to 'never'.
178
+
179
+ --colors <COLOR_SPEC>...
180
+ This flag specifies color settings for use in the output. This flag may be
181
+ provided multiple times. Settings are applied iteratively. Colors are limited
182
+ to one of eight choices: red, blue, green, cyan, magenta, yellow, white and
183
+ black. Styles are limited to nobold, bold, nointense, intense, nounderline
184
+ or underline.
185
+
186
+ The format of the flag is '{type}:{attribute}:{value}'. '{type}' should be
187
+ one of path, line, column or match. '{attribute}' can be fg, bg or style.
188
+ '{value}' is either a color (for fg and bg) or a text style. A special format,
189
+ '{type}:none', will clear all color settings for '{type}'.
190
+
191
+ For example, the following command will change the match color to magenta and
192
+ the background color for line numbers to yellow:
193
+
194
+ rg --colors 'match:fg:magenta' --colors 'line:bg:yellow' foo.
195
+
196
+ Extended colors can be used for '{value}' when the terminal supports ANSI color
197
+ sequences. These are specified as either 'x' (256-color) or 'x,x,x' (24-bit
198
+ truecolor) where x is a number between 0 and 255 inclusive. x may be given as
199
+ a normal decimal number or a hexadecimal number, which is prefixed by `0x`.
200
+
201
+ For example, the following command will change the match background color to
202
+ that represented by the rgb value (0,128,255):
203
+
204
+ rg --colors 'match:bg:0,128,255'
205
+
206
+ or, equivalently,
207
+
208
+ rg --colors 'match:bg:0x0,0x80,0xFF'
209
+
210
+ Note that the the intense and nointense style flags will have no effect when
211
+ used alongside these extended color codes.
212
+
213
+ --column
214
+ Show column numbers (1-based). This only shows the column numbers for the first
215
+ match on each line. This does not try to account for Unicode. One byte is equal
216
+ to one column. This implies --line-number.
217
+
218
+ This flag can be disabled with --no-column.
219
+
220
+ -C, --context <NUM>
221
+ Show NUM lines before and after each match. This is equivalent to providing
222
+ both the -B/--before-context and -A/--after-context flags with the same value.
223
+
224
+ This overrides both the -B/--before-context and -A/--after-context flags,
225
+ in addition to the --passthru flag.
226
+
227
+ --context-separator <SEPARATOR>
228
+ The string used to separate non-contiguous context lines in the output. This
229
+ is only used when one of the context flags is used (-A, -B or -C). Escape
230
+ sequences like \x7F or \t may be used. The default value is --.
231
+
232
+ When the context separator is set to an empty string, then a line break
233
+ is still inserted. To completely disable context separators, use the
234
+ --no-context-separator flag.
235
+
236
+ -c, --count
237
+ This flag suppresses normal output and shows the number of lines that match
238
+ the given patterns for each file searched. Each file containing a match has its
239
+ path and count printed on each line. Note that this reports the number of lines
240
+ that match and not the total number of matches, unless -U/--multiline is
241
+ enabled. In multiline mode, --count is equivalent to --count-matches.
242
+
243
+ If only one file is given to ripgrep, then only the count is printed if there
244
+ is a match. The --with-filename flag can be used to force printing the file
245
+ path in this case. If you need a count to be printed regardless of whether
246
+ there is a match, then use --include-zero.
247
+
248
+ This overrides the --count-matches flag. Note that when --count is combined
249
+ with --only-matching, then ripgrep behaves as if --count-matches was given.
250
+
251
+ --count-matches
252
+ This flag suppresses normal output and shows the number of individual
253
+ matches of the given patterns for each file searched. Each file
254
+ containing matches has its path and match count printed on each line.
255
+ Note that this reports the total number of individual matches and not
256
+ the number of lines that match.
257
+
258
+ If only one file is given to ripgrep, then only the count is printed if there
259
+ is a match. The --with-filename flag can be used to force printing the file
260
+ path in this case.
261
+
262
+ This overrides the --count flag. Note that when --count is combined with
263
+ --only-matching, then ripgrep behaves as if --count-matches was given.
264
+
265
+ --crlf
266
+ When enabled, ripgrep will treat CRLF ('\r\n') as a line terminator instead
267
+ of just '\n'.
268
+
269
+ Principally, this permits '$' in regex patterns to match just before CRLF
270
+ instead of just before LF. The underlying regex engine may not support this
271
+ natively, so ripgrep will translate all instances of '$' to '(?:\r??$)'. This
272
+ may produce slightly different than desired match offsets. It is intended as a
273
+ work-around until the regex engine supports this natively.
274
+
275
+ CRLF support can be disabled with --no-crlf.
276
+
277
+ --debug
278
+ Show debug messages. Please use this when filing a bug report.
279
+
280
+ The --debug flag is generally useful for figuring out why ripgrep skipped
281
+ searching a particular file. The debug messages should mention all files
282
+ skipped and why they were skipped.
283
+
284
+ To get even more debug output, use the --trace flag, which implies --debug
285
+ along with additional trace data. With --trace, the output could be quite
286
+ large and is generally more useful for development.
287
+
288
+ --dfa-size-limit <NUM+SUFFIX?>
289
+ The upper size limit of the regex DFA. The default limit is 10M. This should
290
+ only be changed on very large regex inputs where the (slower) fallback regex
291
+ engine may otherwise be used if the limit is reached.
292
+
293
+ The argument accepts the same size suffixes as allowed in with the
294
+ --max-filesize flag.
295
+
296
+ -E, --encoding <ENCODING>
297
+ Specify the text encoding that ripgrep will use on all files searched. The
298
+ default value is 'auto', which will cause ripgrep to do a best effort automatic
299
+ detection of encoding on a per-file basis. Automatic detection in this case
300
+ only applies to files that begin with a UTF-8 or UTF-16 byte-order mark (BOM).
301
+ No other automatic detection is performed. One can also specify 'none' which
302
+ will then completely disable BOM sniffing and always result in searching the
303
+ raw bytes, including a BOM if it's present, regardless of its encoding.
304
+
305
+ Other supported values can be found in the list of labels here:
306
+ https://encoding.spec.whatwg.org/#concept-encoding-get
307
+
308
+ For more details on encoding and how ripgrep deals with it, see GUIDE.md.
309
+
310
+ This flag can be disabled with --no-encoding.
311
+
312
+ --engine <ENGINE>
313
+ Specify which regular expression engine to use. When you choose a regex engine,
314
+ it applies that choice for every regex provided to ripgrep (e.g., via multiple
315
+ -e/--regexp or -f/--file flags).
316
+
317
+ Accepted values are 'default', 'pcre2', or 'auto'.
318
+
319
+ The default value is 'default', which is the fastest and should be good for
320
+ most use cases. The 'pcre2' engine is generally useful when you want to use
321
+ features such as look-around or backreferences. 'auto' will dynamically choose
322
+ between supported regex engines depending on the features used in a pattern on
323
+ a best effort basis.
324
+
325
+ Note that the 'pcre2' engine is an optional ripgrep feature. If PCRE2 wasn't
326
+ included in your build of ripgrep, then using this flag will result in ripgrep
327
+ printing an error message and exiting.
328
+
329
+ This overrides previous uses of --pcre2 and --auto-hybrid-regex flags.
330
+ [default: default]
331
+ --field-context-separator <SEPARATOR>
332
+ Set the field context separator, which is used to delimit file paths, line
333
+ numbers, columns and the context itself, when printing contextual lines. The
334
+ separator may be any number of bytes, including zero. Escape sequences like
335
+ \x7F or \t may be used. The default value is -.
336
+
337
+ --field-match-separator <SEPARATOR>
338
+ Set the field match separator, which is used to delimit file paths, line
339
+ numbers, columns and the match itself. The separator may be any number of
340
+ bytes, including zero. Escape sequences like \x7F or \t may be used. The
341
+ default value is -.
342
+
343
+ -f, --file <PATTERNFILE>...
344
+ Search for patterns from the given file, with one pattern per line. When this
345
+ flag is used multiple times or in combination with the -e/--regexp flag,
346
+ then all patterns provided are searched. Empty pattern lines will match all
347
+ input lines, and the newline is not counted as part of the pattern.
348
+
349
+ A line is printed if and only if it matches at least one of the patterns.
350
+
351
+ --files
352
+ Print each file that would be searched without actually performing the search.
353
+ This is useful to determine whether a particular file is being searched or not.
354
+
355
+ -l, --files-with-matches
356
+ Print the paths with at least one match and suppress match contents.
357
+
358
+ This overrides --files-without-match.
359
+
360
+ --files-without-match
361
+ Print the paths that contain zero matches and suppress match contents. This
362
+ inverts/negates the --files-with-matches flag.
363
+
364
+ This overrides --files-with-matches.
365
+
366
+ -F, --fixed-strings
367
+ Treat the pattern as a literal string instead of a regular expression. When
368
+ this flag is used, special regular expression meta characters such as .(){}*+
369
+ do not need to be escaped.
370
+
371
+ This flag can be disabled with --no-fixed-strings.
372
+
373
+ -L, --follow
374
+ When this flag is enabled, ripgrep will follow symbolic links while traversing
375
+ directories. This is disabled by default. Note that ripgrep will check for
376
+ symbolic link loops and report errors if it finds one.
377
+
378
+ This flag can be disabled with --no-follow.
379
+
380
+ -g, --glob <GLOB>...
381
+ Include or exclude files and directories for searching that match the given
382
+ glob. This always overrides any other ignore logic. Multiple glob flags may be
383
+ used. Globbing rules match .gitignore globs. Precede a glob with a ! to exclude
384
+ it. If multiple globs match a file or directory, the glob given later in the
385
+ command line takes precedence.
386
+
387
+ As an extension, globs support specifying alternatives: *-g ab{c,d}* is
388
+ equivalet to *-g abc -g abd*. Empty alternatives like *-g ab{,c}* are not
389
+ currently supported. Note that this syntax extension is also currently enabled
390
+ in gitignore files, even though this syntax isn't supported by git itself.
391
+ ripgrep may disable this syntax extension in gitignore files, but it will
392
+ always remain available via the -g/--glob flag.
393
+
394
+ When this flag is set, every file and directory is applied to it to test for
395
+ a match. So for example, if you only want to search in a particular directory
396
+ 'foo', then *-g foo* is incorrect because 'foo/bar' does not match the glob
397
+ 'foo'. Instead, you should use *-g 'foo/**'*.
398
+
399
+ --glob-case-insensitive
400
+ Process glob patterns given with the -g/--glob flag case insensitively. This
401
+ effectively treats --glob as --iglob.
402
+
403
+ This flag can be disabled with the --no-glob-case-insensitive flag.
404
+
405
+ -h, --help
406
+ Prints help information. Use --help for more details.
407
+
408
+ --heading
409
+ This flag prints the file path above clusters of matches from each file instead
410
+ of printing the file path as a prefix for each matched line. This is the
411
+ default mode when printing to a terminal.
412
+
413
+ This overrides the --no-heading flag.
414
+
415
+ -., --hidden
416
+ Search hidden files and directories. By default, hidden files and directories
417
+ are skipped. Note that if a hidden file or a directory is whitelisted in an
418
+ ignore file, then it will be searched even if this flag isn't provided.
419
+
420
+ A file or directory is considered hidden if its base name starts with a dot
421
+ character ('.'). On operating systems which support a `hidden` file attribute,
422
+ like Windows, files with this attribute are also considered hidden.
423
+
424
+ This flag can be disabled with --no-hidden.
425
+
426
+ --iglob <GLOB>...
427
+ Include or exclude files and directories for searching that match the given
428
+ glob. This always overrides any other ignore logic. Multiple glob flags may be
429
+ used. Globbing rules match .gitignore globs. Precede a glob with a ! to exclude
430
+ it. Globs are matched case insensitively.
431
+
432
+ -i, --ignore-case
433
+ When this flag is provided, the given patterns will be searched case
434
+ insensitively. The case insensitivity rules used by ripgrep conform to
435
+ Unicode's "simple" case folding rules.
436
+
437
+ This flag overrides -s/--case-sensitive and -S/--smart-case.
438
+
439
+ --ignore-file <PATH>...
440
+ Specifies a path to one or more .gitignore format rules files. These patterns
441
+ are applied after the patterns found in .gitignore and .ignore are applied
442
+ and are matched relative to the current working directory. Multiple additional
443
+ ignore files can be specified by using the --ignore-file flag several times.
444
+ When specifying multiple ignore files, earlier files have lower precedence
445
+ than later files.
446
+
447
+ If you are looking for a way to include or exclude files and directories
448
+ directly on the command line, then used -g instead.
449
+
450
+ --ignore-file-case-insensitive
451
+ Process ignore files (.gitignore, .ignore, etc.) case insensitively. Note that
452
+ this comes with a performance penalty and is most useful on case insensitive
453
+ file systems (such as Windows).
454
+
455
+ This flag can be disabled with the --no-ignore-file-case-insensitive flag.
456
+
457
+ --include-zero
458
+ When used with --count or --count-matches, print the number of matches for
459
+ each file even if there were zero matches. This is disabled by default but can
460
+ be enabled to make ripgrep behave more like grep.
461
+
462
+ -v, --invert-match
463
+ Invert matching. Show lines that do not match the given patterns.
464
+
465
+ --json
466
+ Enable printing results in a JSON Lines format.
467
+
468
+ When this flag is provided, ripgrep will emit a sequence of messages, each
469
+ encoded as a JSON object, where there are five different message types:
470
+
471
+ **begin** - A message that indicates a file is being searched and contains at
472
+ least one match.
473
+
474
+ **end** - A message the indicates a file is done being searched. This message
475
+ also include summary statistics about the search for a particular file.
476
+
477
+ **match** - A message that indicates a match was found. This includes the text
478
+ and offsets of the match.
479
+
480
+ **context** - A message that indicates a contextual line was found. This
481
+ includes the text of the line, along with any match information if the search
482
+ was inverted.
483
+
484
+ **summary** - The final message emitted by ripgrep that contains summary
485
+ statistics about the search across all files.
486
+
487
+ Since file paths or the contents of files are not guaranteed to be valid UTF-8
488
+ and JSON itself must be representable by a Unicode encoding, ripgrep will emit
489
+ all data elements as objects with one of two keys: 'text' or 'bytes'. 'text' is
490
+ a normal JSON string when the data is valid UTF-8 while 'bytes' is the base64
491
+ encoded contents of the data.
492
+
493
+ The JSON Lines format is only supported for showing search results. It cannot
494
+ be used with other flags that emit other types of output, such as --files,
495
+ --files-with-matches, --files-without-match, --count or --count-matches.
496
+ ripgrep will report an error if any of the aforementioned flags are used in
497
+ concert with --json.
498
+
499
+ Other flags that control aspects of the standard output such as
500
+ --only-matching, --heading, --replace, --max-columns, etc., have no effect
501
+ when --json is set.
502
+
503
+ A more complete description of the JSON format used can be found here:
504
+ https://docs.rs/grep-printer/*/grep_printer/struct.JSON.html
505
+
506
+ The JSON Lines format can be disabled with --no-json.
507
+
508
+ --line-buffered
509
+ When enabled, ripgrep will use line buffering. That is, whenever a matching
510
+ line is found, it will be flushed to stdout immediately. This is the default
511
+ when ripgrep's stdout is connected to a terminal, but otherwise, ripgrep will
512
+ use block buffering, which is typically faster. This flag forces ripgrep to
513
+ use line buffering even if it would otherwise use block buffering. This is
514
+ typically useful in shell pipelines, e.g.,
515
+ 'tail -f something.log | rg foo --line-buffered | rg bar'.
516
+
517
+ Forceful line buffering can be disabled with --no-line-buffered. Note that
518
+ using --no-line-buffered causes ripgrep to revert to its default behavior of
519
+ automatically detecting the buffering strategy. To force block buffering, use
520
+ the --block-buffered flag.
521
+
522
+ -n, --line-number
523
+ Show line numbers (1-based). This is enabled by default when searching in a
524
+ terminal.
525
+
526
+ -x, --line-regexp
527
+ Only show matches surrounded by line boundaries. This is equivalent to putting
528
+ ^...$ around all of the search patterns. In other words, this only prints lines
529
+ where the entire line participates in a match.
530
+
531
+ This overrides the --word-regexp flag.
532
+
533
+ -M, --max-columns <NUM>
534
+ Don't print lines longer than this limit in bytes. Longer lines are omitted,
535
+ and only the number of matches in that line is printed.
536
+
537
+ When this flag is omitted or is set to 0, then it has no effect.
538
+
539
+ --max-columns-preview
540
+ When the '--max-columns' flag is used, ripgrep will by default completely
541
+ replace any line that is too long with a message indicating that a matching
542
+ line was removed. When this flag is combined with '--max-columns', a preview
543
+ of the line (corresponding to the limit size) is shown instead, where the part
544
+ of the line exceeding the limit is not shown.
545
+
546
+ If the '--max-columns' flag is not set, then this has no effect.
547
+
548
+ This flag can be disabled with '--no-max-columns-preview'.
549
+
550
+ -m, --max-count <NUM>
551
+ Limit the number of matching lines per file searched to NUM.
552
+
553
+ --max-depth <NUM>
554
+ Limit the depth of directory traversal to NUM levels beyond the paths given. A
555
+ value of zero only searches the explicitly given paths themselves.
556
+
557
+ For example, 'rg --max-depth 0 dir/' is a no-op because dir/ will not be
558
+ descended into. 'rg --max-depth 1 dir/' will search only the direct children of
559
+ 'dir'.
560
+
561
+ --max-filesize <NUM+SUFFIX?>
562
+ Ignore files larger than NUM in size. This does not apply to directories.
563
+
564
+ The input format accepts suffixes of K, M or G which correspond to kilobytes,
565
+ megabytes and gigabytes, respectively. If no suffix is provided the input is
566
+ treated as bytes.
567
+
568
+ Examples: --max-filesize 50K or --max-filesize 80M
569
+
570
+ --mmap
571
+ Search using memory maps when possible. This is enabled by default when ripgrep
572
+ thinks it will be faster.
573
+
574
+ Memory map searching doesn't currently support all options, so if an
575
+ incompatible option (e.g., --context) is given with --mmap, then memory maps
576
+ will not be used.
577
+
578
+ Note that ripgrep may abort unexpectedly when --mmap if it searches a file that
579
+ is simultaneously truncated.
580
+
581
+ This flag overrides --no-mmap.
582
+
583
+ -U, --multiline
584
+ Enable matching across multiple lines.
585
+
586
+ When multiline mode is enabled, ripgrep will lift the restriction that a match
587
+ cannot include a line terminator. For example, when multiline mode is not
588
+ enabled (the default), then the regex '\p{any}' will match any Unicode
589
+ codepoint other than '\n'. Similarly, the regex '\n' is explicitly forbidden,
590
+ and if you try to use it, ripgrep will return an error. However, when multiline
591
+ mode is enabled, '\p{any}' will match any Unicode codepoint, including '\n',
592
+ and regexes like '\n' are permitted.
593
+
594
+ An important caveat is that multiline mode does not change the match semantics
595
+ of '.'. Namely, in most regex matchers, a '.' will by default match any
596
+ character other than '\n', and this is true in ripgrep as well. In order to
597
+ make '.' match '\n', you must enable the "dot all" flag inside the regex.
598
+ For example, both '(?s).' and '(?s:.)' have the same semantics, where '.' will
599
+ match any character, including '\n'. Alternatively, the '--multiline-dotall'
600
+ flag may be passed to make the "dot all" behavior the default. This flag only
601
+ applies when multiline search is enabled.
602
+
603
+ There is no limit on the number of the lines that a single match can span.
604
+
605
+ **WARNING**: Because of how the underlying regex engine works, multiline
606
+ searches may be slower than normal line-oriented searches, and they may also
607
+ use more memory. In particular, when multiline mode is enabled, ripgrep
608
+ requires that each file it searches is laid out contiguously in memory
609
+ (either by reading it onto the heap or by memory-mapping it). Things that
610
+ cannot be memory-mapped (such as stdin) will be consumed until EOF before
611
+ searching can begin. In general, ripgrep will only do these things when
612
+ necessary. Specifically, if the --multiline flag is provided but the regex
613
+ does not contain patterns that would match '\n' characters, then ripgrep
614
+ will automatically avoid reading each file into memory before searching it.
615
+ Nevertheless, if you only care about matches spanning at most one line, then it
616
+ is always better to disable multiline mode.
617
+
618
+ This flag can be disabled with --no-multiline.
619
+
620
+ --multiline-dotall
621
+ This flag enables "dot all" in your regex pattern, which causes '.' to match
622
+ newlines when multiline searching is enabled. This flag has no effect if
623
+ multiline searching isn't enabled with the --multiline flag.
624
+
625
+ Normally, a '.' will match any character except newlines. While this behavior
626
+ typically isn't relevant for line-oriented matching (since matches can span at
627
+ most one line), this can be useful when searching with the -U/--multiline flag.
628
+ By default, the multiline mode runs without this flag.
629
+
630
+ This flag is generally intended to be used in an alias or your ripgrep config
631
+ file if you prefer "dot all" semantics by default. Note that regardless of
632
+ whether this flag is used, "dot all" semantics can still be controlled via
633
+ inline flags in the regex pattern itself, e.g., '(?s:.)' always enables "dot
634
+ all" whereas '(?-s:.)' always disables "dot all".
635
+
636
+ This flag can be disabled with --no-multiline-dotall.
637
+
638
+ --no-config
639
+ Never read configuration files. When this flag is present, ripgrep will not
640
+ respect the RIPGREP_CONFIG_PATH environment variable.
641
+
642
+ If ripgrep ever grows a feature to automatically read configuration files in
643
+ pre-defined locations, then this flag will also disable that behavior as well.
644
+
645
+ -I, --no-filename
646
+ Never print the file path with the matched lines. This is the default when
647
+ ripgrep is explicitly instructed to search one file or stdin.
648
+
649
+ This flag overrides --with-filename.
650
+
651
+ --no-heading
652
+ Don't group matches by each file. If --no-heading is provided in addition to
653
+ the -H/--with-filename flag, then file paths will be printed as a prefix for
654
+ every matched line. This is the default mode when not printing to a terminal.
655
+
656
+ This overrides the --heading flag.
657
+
658
+ --no-ignore
659
+ Don't respect ignore files (.gitignore, .ignore, etc.). This implies
660
+ --no-ignore-dot, --no-ignore-exclude, --no-ignore-global, no-ignore-parent and
661
+ --no-ignore-vcs.
662
+
663
+ This does *not* imply --no-ignore-files, since --ignore-file is specified
664
+ explicitly as a command line argument.
665
+
666
+ When given only once, the -u flag is identical in behavior to --no-ignore and
667
+ can be considered an alias. However, subsequent -u flags have additional
668
+ effects; see --unrestricted.
669
+
670
+ This flag can be disabled with the --ignore flag.
671
+
672
+ --no-ignore-dot
673
+ Don't respect .ignore files.
674
+
675
+ This does *not* affect whether ripgrep will ignore files and directories
676
+ whose names begin with a dot. For that, see the -./--hidden flag.
677
+
678
+ This flag can be disabled with the --ignore-dot flag.
679
+
680
+ --no-ignore-exclude
681
+ Don't respect ignore files that are manually configured for the repository
682
+ such as git's '.git/info/exclude'.
683
+
684
+ This flag can be disabled with the --ignore-exclude flag.
685
+
686
+ --no-ignore-files
687
+ When set, any --ignore-file flags, even ones that come after this flag, are
688
+ ignored.
689
+
690
+ This flag can be disabled with the --ignore-files flag.
691
+
692
+ --no-ignore-global
693
+ Don't respect ignore files that come from "global" sources such as git's
694
+ `core.excludesFile` configuration option (which defaults to
695
+ `$HOME/.config/git/ignore`).
696
+
697
+ This flag can be disabled with the --ignore-global flag.
698
+
699
+ --no-ignore-messages
700
+ Suppresses all error messages related to parsing ignore files such as .ignore
701
+ or .gitignore.
702
+
703
+ This flag can be disabled with the --ignore-messages flag.
704
+
705
+ --no-ignore-parent
706
+ Don't respect ignore files (.gitignore, .ignore, etc.) in parent directories.
707
+
708
+ This flag can be disabled with the --ignore-parent flag.
709
+
710
+ --no-ignore-vcs
711
+ Don't respect version control ignore files (.gitignore, etc.). This implies
712
+ --no-ignore-parent for VCS files. Note that .ignore files will continue to be
713
+ respected.
714
+
715
+ This flag can be disabled with the --ignore-vcs flag.
716
+
717
+ -N, --no-line-number
718
+ Suppress line numbers. This is enabled by default when not searching in a
719
+ terminal.
720
+
721
+ --no-messages
722
+ Suppress all error messages related to opening and reading files. Error
723
+ messages related to the syntax of the pattern given are still shown.
724
+
725
+ This flag can be disabled with the --messages flag.
726
+
727
+ --no-mmap
728
+ Never use memory maps, even when they might be faster.
729
+
730
+ This flag overrides --mmap.
731
+
732
+ --no-pcre2-unicode
733
+ DEPRECATED. Use --no-unicode instead.
734
+
735
+ This flag is now an alias for --no-unicode. And --pcre2-unicode is an alias
736
+ for --unicode.
737
+
738
+ --no-require-git
739
+ By default, ripgrep will only respect global gitignore rules, .gitignore rules
740
+ and local exclude rules if ripgrep detects that you are searching inside a
741
+ git repository. This flag allows you to relax this restriction such that
742
+ ripgrep will respect all git related ignore rules regardless of whether you're
743
+ searching in a git repository or not.
744
+
745
+ This flag can be disabled with --require-git.
746
+
747
+ --no-unicode
748
+ By default, ripgrep will enable "Unicode mode" in all of its regexes. This
749
+ has a number of consequences:
750
+
751
+ * '.' will only match valid UTF-8 encoded scalar values.
752
+ * Classes like '\w', '\s', '\d' are all Unicode aware and much bigger
753
+ than their ASCII only versions.
754
+ * Case insensitive matching will use Unicode case folding.
755
+ * A large array of classes like '\p{Emoji}' are available.
756
+ * Word boundaries ('\b' and '\B') use the Unicode definition of a word
757
+ character.
758
+
759
+ In some cases it can be desirable to turn these things off. The --no-unicode
760
+ flag will do exactly that.
761
+
762
+ For PCRE2 specifically, Unicode mode represents a critical trade off in the
763
+ user experience of ripgrep. In particular, unlike the default regex engine,
764
+ PCRE2 does not support the ability to search possibly invalid UTF-8 with
765
+ Unicode features enabled. Instead, PCRE2 *requires* that everything it searches
766
+ when Unicode mode is enabled is valid UTF-8. (Or valid UTF-16/UTF-32, but for
767
+ the purposes of ripgrep, we only discuss UTF-8.) This means that if you have
768
+ PCRE2's Unicode mode enabled and you attempt to search invalid UTF-8, then
769
+ the search for that file will halt and print an error. For this reason, when
770
+ PCRE2's Unicode mode is enabled, ripgrep will automatically "fix" invalid
771
+ UTF-8 sequences by replacing them with the Unicode replacement codepoint. This
772
+ penalty does not occur when using the default regex engine.
773
+
774
+ If you would rather see the encoding errors surfaced by PCRE2 when Unicode mode
775
+ is enabled, then pass the --no-encoding flag to disable all transcoding.
776
+
777
+ The --no-unicode flag can be disabled with --unicode. Note that
778
+ --no-pcre2-unicode and --pcre2-unicode are aliases for --no-unicode and
779
+ --unicode, respectively.
780
+
781
+ -0, --null
782
+ Whenever a file path is printed, follow it with a NUL byte. This includes
783
+ printing file paths before matches, and when printing a list of matching files
784
+ such as with --count, --files-with-matches and --files. This option is useful
785
+ for use with xargs.
786
+
787
+ --null-data
788
+ Enabling this option causes ripgrep to use NUL as a line terminator instead of
789
+ the default of '\n'.
790
+
791
+ This is useful when searching large binary files that would otherwise have very
792
+ long lines if '\n' were used as the line terminator. In particular, ripgrep
793
+ requires that, at a minimum, each line must fit into memory. Using NUL instead
794
+ can be a useful stopgap to keep memory requirements low and avoid OOM (out of
795
+ memory) conditions.
796
+
797
+ This is also useful for processing NUL delimited data, such as that emitted
798
+ when using ripgrep's -0/--null flag or find's --print0 flag.
799
+
800
+ Using this flag implies -a/--text.
801
+
802
+ --one-file-system
803
+ When enabled, ripgrep will not cross file system boundaries relative to where
804
+ the search started from.
805
+
806
+ Note that this applies to each path argument given to ripgrep. For example, in
807
+ the command 'rg --one-file-system /foo/bar /quux/baz', ripgrep will search both
808
+ '/foo/bar' and '/quux/baz' even if they are on different file systems, but will
809
+ not cross a file system boundary when traversing each path's directory tree.
810
+
811
+ This is similar to find's '-xdev' or '-mount' flag.
812
+
813
+ This flag can be disabled with --no-one-file-system.
814
+
815
+ -o, --only-matching
816
+ Print only the matched (non-empty) parts of a matching line, with each such
817
+ part on a separate output line.
818
+
819
+ --passthru
820
+ Print both matching and non-matching lines.
821
+
822
+ Another way to achieve a similar effect is by modifying your pattern to match
823
+ the empty string. For example, if you are searching using 'rg foo' then using
824
+ 'rg "^|foo"' instead will emit every line in every file searched, but only
825
+ occurrences of 'foo' will be highlighted. This flag enables the same behavior
826
+ without needing to modify the pattern.
827
+
828
+ This overrides the --context, --after-context and --before-context flags.
829
+
830
+ --path-separator <SEPARATOR>
831
+ Set the path separator to use when printing file paths. This defaults to your
832
+ platform's path separator, which is / on Unix and \ on Windows. This flag is
833
+ intended for overriding the default when the environment demands it (e.g.,
834
+ cygwin). A path separator is limited to a single byte.
835
+
836
+ -P, --pcre2
837
+ When this flag is present, ripgrep will use the PCRE2 regex engine instead of
838
+ its default regex engine.
839
+
840
+ This is generally useful when you want to use features such as look-around
841
+ or backreferences.
842
+
843
+ Note that PCRE2 is an optional ripgrep feature. If PCRE2 wasn't included in
844
+ your build of ripgrep, then using this flag will result in ripgrep printing
845
+ an error message and exiting. PCRE2 may also have worse user experience in
846
+ some cases, since it has fewer introspection APIs than ripgrep's default regex
847
+ engine. For example, if you use a '\n' in a PCRE2 regex without the
848
+ '-U/--multiline' flag, then ripgrep will silently fail to match anything
849
+ instead of reporting an error immediately (like it does with the default
850
+ regex engine).
851
+
852
+ Related flags: --no-pcre2-unicode
853
+
854
+ This flag can be disabled with --no-pcre2.
855
+
856
+ --pcre2-version
857
+ When this flag is present, ripgrep will print the version of PCRE2 in use,
858
+ along with other information, and then exit. If PCRE2 is not available, then
859
+ ripgrep will print an error message and exit with an error code.
860
+
861
+ --pre <COMMAND>
862
+ For each input FILE, search the standard output of COMMAND FILE rather than the
863
+ contents of FILE. This option expects the COMMAND program to either be an
864
+ absolute path or to be available in your PATH. Either an empty string COMMAND
865
+ or the '--no-pre' flag will disable this behavior.
866
+
867
+ WARNING: When this flag is set, ripgrep will unconditionally spawn a
868
+ process for every file that is searched. Therefore, this can incur an
869
+ unnecessarily large performance penalty if you don't otherwise need the
870
+ flexibility offered by this flag. One possible mitigation to this is to use
871
+ the '--pre-glob' flag to limit which files a preprocessor is run with.
872
+
873
+ A preprocessor is not run when ripgrep is searching stdin.
874
+
875
+ When searching over sets of files that may require one of several decoders
876
+ as preprocessors, COMMAND should be a wrapper program or script which first
877
+ classifies FILE based on magic numbers/content or based on the FILE name and
878
+ then dispatches to an appropriate preprocessor. Each COMMAND also has its
879
+ standard input connected to FILE for convenience.
880
+
881
+ For example, a shell script for COMMAND might look like:
882
+
883
+ case "$1" in
884
+ *.pdf)
885
+ exec pdftotext "$1" -
886
+ ;;
887
+ *)
888
+ case $(file "$1") in
889
+ *Zstandard*)
890
+ exec pzstd -cdq
891
+ ;;
892
+ *)
893
+ exec cat
894
+ ;;
895
+ esac
896
+ ;;
897
+ esac
898
+
899
+ The above script uses `pdftotext` to convert a PDF file to plain text. For
900
+ all other files, the script uses the `file` utility to sniff the type of the
901
+ file based on its contents. If it is a compressed file in the Zstandard format,
902
+ then `pzstd` is used to decompress the contents to stdout.
903
+
904
+ This overrides the -z/--search-zip flag.
905
+
906
+ --pre-glob <GLOB>...
907
+ This flag works in conjunction with the --pre flag. Namely, when one or more
908
+ --pre-glob flags are given, then only files that match the given set of globs
909
+ will be handed to the command specified by the --pre flag. Any non-matching
910
+ files will be searched without using the preprocessor command.
911
+
912
+ This flag is useful when searching many files with the --pre flag. Namely,
913
+ it permits the ability to avoid process overhead for files that don't need
914
+ preprocessing. For example, given the following shell script, 'pre-pdftotext':
915
+
916
+ #!/bin/sh
917
+
918
+ pdftotext "$1" -
919
+
920
+ then it is possible to use '--pre pre-pdftotext --pre-glob '*.pdf'' to make
921
+ it so ripgrep only executes the 'pre-pdftotext' command on files with a '.pdf'
922
+ extension.
923
+
924
+ Multiple --pre-glob flags may be used. Globbing rules match .gitignore globs.
925
+ Precede a glob with a ! to exclude it.
926
+
927
+ This flag has no effect if the --pre flag is not used.
928
+
929
+ -p, --pretty
930
+ This is a convenience alias for '--color always --heading --line-number'. This
931
+ flag is useful when you still want pretty output even if you're piping ripgrep
932
+ to another program or file. For example: 'rg -p foo | less -R'.
933
+
934
+ -q, --quiet
935
+ Do not print anything to stdout. If a match is found in a file, then ripgrep
936
+ will stop searching. This is useful when ripgrep is used only for its exit
937
+ code (which will be an error if no matches are found).
938
+
939
+ When --files is used, then ripgrep will stop finding files after finding the
940
+ first file that matches all ignore rules.
941
+
942
+ --regex-size-limit <NUM+SUFFIX?>
943
+ The upper size limit of the compiled regex. The default limit is 10M.
944
+
945
+ The argument accepts the same size suffixes as allowed in the --max-filesize
946
+ flag.
947
+
948
+ -e, --regexp <PATTERN>...
949
+ A pattern to search for. This option can be provided multiple times, where
950
+ all patterns given are searched. Lines matching at least one of the provided
951
+ patterns are printed. This flag can also be used when searching for patterns
952
+ that start with a dash.
953
+
954
+ For example, to search for the literal '-foo', you can use this flag:
955
+
956
+ rg -e -foo
957
+
958
+ You can also use the special '--' delimiter to indicate that no more flags
959
+ will be provided. Namely, the following is equivalent to the above:
960
+
961
+ rg -- -foo
962
+
963
+ -r, --replace <REPLACEMENT_TEXT>
964
+ Replace every match with the text given when printing results. Neither this
965
+ flag nor any other ripgrep flag will modify your files.
966
+
967
+ Capture group indices (e.g., $5) and names (e.g., $foo) are supported in the
968
+ replacement string. Capture group indices are numbered based on the position of
969
+ the opening parenthesis of the group, where the leftmost such group is $1. The
970
+ special $0 group corresponds to the entire match.
971
+
972
+ In shells such as Bash and zsh, you should wrap the pattern in single quotes
973
+ instead of double quotes. Otherwise, capture group indices will be replaced by
974
+ expanded shell variables which will most likely be empty.
975
+
976
+ To write a literal '$', use '$$'.
977
+
978
+ Note that the replacement by default replaces each match, and NOT the entire
979
+ line. To replace the entire line, you should match the entire line.
980
+
981
+ This flag can be used with the -o/--only-matching flag.
982
+
983
+ -z, --search-zip
984
+ Search in compressed files. Currently gzip, bzip2, xz, LZ4, LZMA, Brotli and
985
+ Zstd files are supported. This option expects the decompression binaries to be
986
+ available in your PATH.
987
+
988
+ This flag can be disabled with --no-search-zip.
989
+
990
+ -S, --smart-case
991
+ Searches case insensitively if the pattern is all lowercase. Search case
992
+ sensitively otherwise.
993
+
994
+ A pattern is considered all lowercase if both of the following rules hold:
995
+
996
+ First, the pattern contains at least one literal character. For example, 'a\w'
997
+ contains a literal ('a') but just '\w' does not.
998
+
999
+ Second, of the literals in the pattern, none of them are considered to be
1000
+ uppercase according to Unicode. For example, 'foo\pL' has no uppercase
1001
+ literals but 'Foo\pL' does.
1002
+
1003
+ This overrides the -s/--case-sensitive and -i/--ignore-case flags.
1004
+
1005
+ --sort <SORTBY>
1006
+ This flag enables sorting of results in ascending order. The possible values
1007
+ for this flag are:
1008
+
1009
+ none (Default) Do not sort results. Fastest. Can be multi-threaded.
1010
+ path Sort by file path. Always single-threaded.
1011
+ modified Sort by the last modified time on a file. Always single-threaded.
1012
+ accessed Sort by the last accessed time on a file. Always single-threaded.
1013
+ created Sort by the creation time on a file. Always single-threaded.
1014
+
1015
+ If the chosen (manually or by-default) sorting criteria isn't available on your
1016
+ system (for example, creation time is not available on ext4 file systems), then
1017
+ ripgrep will attempt to detect this, print an error and exit without searching.
1018
+
1019
+ To sort results in reverse or descending order, use the --sortr flag. Also,
1020
+ this flag overrides --sortr.
1021
+
1022
+ Note that sorting results currently always forces ripgrep to abandon
1023
+ parallelism and run in a single thread.
1024
+
1025
+ --sortr <SORTBY>
1026
+ This flag enables sorting of results in descending order. The possible values
1027
+ for this flag are:
1028
+
1029
+ none (Default) Do not sort results. Fastest. Can be multi-threaded.
1030
+ path Sort by file path. Always single-threaded.
1031
+ modified Sort by the last modified time on a file. Always single-threaded.
1032
+ accessed Sort by the last accessed time on a file. Always single-threaded.
1033
+ created Sort by the creation time on a file. Always single-threaded.
1034
+
1035
+ If the chosen (manually or by-default) sorting criteria isn't available on your
1036
+ system (for example, creation time is not available on ext4 file systems), then
1037
+ ripgrep will attempt to detect this, print an error and exit without searching.
1038
+
1039
+ To sort results in ascending order, use the --sort flag. Also, this flag
1040
+ overrides --sort.
1041
+
1042
+ Note that sorting results currently always forces ripgrep to abandon
1043
+ parallelism and run in a single thread.
1044
+
1045
+ --stats
1046
+ Print aggregate statistics about this ripgrep search. When this flag is
1047
+ present, ripgrep will print the following stats to stdout at the end of the
1048
+ search: number of matched lines, number of files with matches, number of files
1049
+ searched, and the time taken for the entire search to complete.
1050
+
1051
+ This set of aggregate statistics may expand over time.
1052
+
1053
+ Note that this flag has no effect if --files, --files-with-matches or
1054
+ --files-without-match is passed.
1055
+
1056
+ This flag can be disabled with --no-stats.
1057
+
1058
+ -a, --text
1059
+ Search binary files as if they were text. When this flag is present, ripgrep's
1060
+ binary file detection is disabled. This means that when a binary file is
1061
+ searched, its contents may be printed if there is a match. This may cause
1062
+ escape codes to be printed that alter the behavior of your terminal.
1063
+
1064
+ When binary file detection is enabled it is imperfect. In general, it uses
1065
+ a simple heuristic. If a NUL byte is seen during search, then the file is
1066
+ considered binary and search stops (unless this flag is present).
1067
+ Alternatively, if the '--binary' flag is used, then ripgrep will only quit
1068
+ when it sees a NUL byte after it sees a match (or searches the entire file).
1069
+
1070
+ This flag can be disabled with '--no-text'. It overrides the '--binary' flag.
1071
+
1072
+ -j, --threads <NUM>
1073
+ The approximate number of threads to use. A value of 0 (which is the default)
1074
+ causes ripgrep to choose the thread count using heuristics.
1075
+
1076
+ --trim
1077
+ When set, all ASCII whitespace at the beginning of each line printed will be
1078
+ trimmed.
1079
+
1080
+ This flag can be disabled with --no-trim.
1081
+
1082
+ -t, --type <TYPE>...
1083
+ Only search files matching TYPE. Multiple type flags may be provided. Use the
1084
+ --type-list flag to list all available types.
1085
+
1086
+ This flag supports the special value 'all', which will behave as if --type
1087
+ was provided for every file type supported by ripgrep (including any custom
1088
+ file types). The end result is that '--type all' causes ripgrep to search in
1089
+ "whitelist" mode, where it will only search files it recognizes via its type
1090
+ definitions.
1091
+
1092
+ --type-add <TYPE_SPEC>...
1093
+ Add a new glob for a particular file type. Only one glob can be added at a
1094
+ time. Multiple --type-add flags can be provided. Unless --type-clear is used,
1095
+ globs are added to any existing globs defined inside of ripgrep.
1096
+
1097
+ Note that this MUST be passed to every invocation of ripgrep. Type settings are
1098
+ NOT persisted. See CONFIGURATION FILES for a workaround.
1099
+
1100
+ Example:
1101
+
1102
+ rg --type-add 'foo:*.foo' -tfoo PATTERN.
1103
+
1104
+ --type-add can also be used to include rules from other types with the special
1105
+ include directive. The include directive permits specifying one or more other
1106
+ type names (separated by a comma) that have been defined and its rules will
1107
+ automatically be imported into the type specified. For example, to create a
1108
+ type called src that matches C++, Python and Markdown files, one can use:
1109
+
1110
+ --type-add 'src:include:cpp,py,md'
1111
+
1112
+ Additional glob rules can still be added to the src type by using the
1113
+ --type-add flag again:
1114
+
1115
+ --type-add 'src:include:cpp,py,md' --type-add 'src:*.foo'
1116
+
1117
+ Note that type names must consist only of Unicode letters or numbers.
1118
+ Punctuation characters are not allowed.
1119
+
1120
+ --type-clear <TYPE>...
1121
+ Clear the file type globs previously defined for TYPE. This only clears the
1122
+ default type definitions that are found inside of ripgrep.
1123
+
1124
+ Note that this MUST be passed to every invocation of ripgrep. Type settings are
1125
+ NOT persisted. See CONFIGURATION FILES for a workaround.
1126
+
1127
+ --type-list
1128
+ Show all supported file types and their corresponding globs.
1129
+
1130
+ -T, --type-not <TYPE>...
1131
+ Do not search files matching TYPE. Multiple type-not flags may be provided. Use
1132
+ the --type-list flag to list all available types.
1133
+
1134
+ -u, --unrestricted
1135
+ Reduce the level of "smart" searching. A single -u won't respect .gitignore
1136
+ (etc.) files (--no-ignore). Two -u flags will additionally search hidden files
1137
+ and directories (-./--hidden). Three -u flags will additionally search binary
1138
+ files (--binary).
1139
+
1140
+ 'rg -uuu' is roughly equivalent to 'grep -r'.
1141
+
1142
+ -V, --version
1143
+ Prints version information
1144
+
1145
+ --vimgrep
1146
+ Show results with every match on its own line, including line numbers and
1147
+ column numbers. With this option, a line with more than one match will be
1148
+ printed more than once.
1149
+
1150
+ -H, --with-filename
1151
+ Display the file path for matches. This is the default when more than one
1152
+ file is searched. If --heading is enabled (the default when printing to a
1153
+ terminal), the file path will be shown above clusters of matches from each
1154
+ file; otherwise, the file name will be shown as a prefix for each matched line.
1155
+
1156
+ This flag overrides --no-filename.
1157
+
1158
+ -w, --word-regexp
1159
+ Only show matches surrounded by word boundaries. This is roughly equivalent to
1160
+ putting \b before and after all of the search patterns.
1161
+
1162
+ This overrides the --line-regexp flag.
1163
+