5 ms·
actually most of the time you might want to use rg -i searchterm . I don't know why its not default? May be they want to make it similar to grep but with perf?
by cute_boi 5y ago
actually most of the time you might want to use rg -i searchterm . I don't know why its not default? May be they want to make it similar to grep but with perf?
- simonw 5y ago-i is ignore-case, right? Usually I'm searching code for things like variable names, so actually case-sensitive searches are a better default for me.
- raziel2p 5y ago--smart-case is worth looking into as well. you can also put whatever arguments you want in your ripgreprc file to tweak the "defaults" to your liking.
- bostonvaulter2 5y agoI think that's a bit of a personal choice. I definitely prefer the current default of an exact match including case. Partially because I'm very familiar with the common `-i` flag to ignore case which is used in `grep`, `git grep`, `ack`, `ag` and probably others. But I've never used a flag to make a search case-sensitive. Plus it's easy enough to alias `rg` to `rg -i` if you prefer that as the default.
- Hamuko 5y agoI almost never use -i. I may do rg "[Dd]efault" if I want to search for "default" or "Default", but not "DEFAULT". Usually I just want to search in a very specific case since I'm looking for variables.
- burntsushi 5y agoIt's not the default because I personally find it pretty unintuitive, and while I don't have any numbers, I think most others do too. When I'm comparing ripgrep with other tools that enable smart case (like -i, but is disabled if there are any literal capital characters in your pattern) by default, I still get tripped by it because I forget about it. On Unix, you can just do `alias rg="rg -S"`, and you get smart-case by default. :-) Or if you truly always want case insensitive by default, then `alias rg="rg -i"`. "make ripgrep similar to grep" is certainly one goal, but there are other goals that compete with that and whether or not ripgrep matches grep's behavior with respect to case sensitivity is only one small piece of that. It was proposed to enable --smart-case by default: https://github.com/BurntSushi/ripgrep/issues/178 https://github.com/BurntSushi/ripgrep/issues/178
- buerkle 5y agoripgrep also has a configuration file for options without the need for an alias. https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#c...
- e12e 5y agoOh, I hope the current default stays!:) I usually know when I want case insensitive match - and I frequently want case-sensitivity with all lowercase search terms. Eg: doing a search for methods or variables in ruby - where "model" is right, but "Model" is a class or module (and vice-versa - but then smart case would work).
- burntsushi 5y agoDon't worry, it will. :-) While I do allow for breaking changes between major versions, I don't really see myself ever doing any kind of major breaking change. Especially one that subtly changes match semantics in a really major way.
- twic 5y agoThe other flag to know about is --no-ignore, or alternatively -u/--unrestricted. By default, ripgrep does not search a bunch of files, in particular anything gitignored and anything with a leading dot (which the docs call "hidden"): https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#automatic-filtering https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#a... These flags override that.