1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 23:28:02 +00:00

Add Unrestrict Where ripgrep Searches as a Unix TIL

This commit is contained in:
jbranchaud
2024-04-04 13:24:51 -05:00
parent b2ddce62fd
commit f54eab20e7
2 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
# Unrestrict Where ripgrep Searches
One of the conveniences of [`rg`
(ripgrep)](https://github.com/BurntSushi/ripgrep) is that by default it doesn't
search in places you probably don't want it to search. That means it ignores
anything specified by your `.gitignore` file, it excludes hidden files and
directories (dotfiles, e.g. `.git/` or `.env`), and it excludes binary files.
These restrictions can be incrementally undone as needed using the `-u` flag.
The `-u` flag on its own will remove the ignored files restriction. This is
equivalent to the `--no-ignore` flag.
```bash
$ rg -u pattern
```
Adding an additional `u` (`-uu`) to that flag will remove both the ignored files and
hidden files restrictions. This is a shorthand equivalent to both `--no-ignore`
and `--hidden`.
```bash
$ rg -uu pattern
```
Adding one more `u` (`-uuu`) will additionally remove the binary file
restriction. Equivalent to those other two flags plus `--text`.
```bash
$ rg -uuu pattern
```
[source](https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#automatic-filtering)