Hacker News new | ask | show | jobs
by benjaminjackman 1711 days ago
I also default to use ag now and it is good at picking up things like .gitignores to exclude files. It works very well, I just wish it had a flag to limit the size of files searched because if a large file is found it can make the results harder to parse visually and most of the times when programming I only want to scan files that are under 100k (at most ... probably 10k is fine for a first pass).

This is really bad if the large file is some concatenated minimized javascript thing that is one massive line, then that really makes the results harder explore ( I tend to `ag foosearchterm | less -R` at that point) . Perhaps capping the line length in a result is another solution, if a line is over a couple hundred chars only show the relevant portion.

1 comments

If you use ripgrep, -o will only show the matching part of the line. It also has a --max-filesize flag.
Thank you! I just tried it and --max-filesize worked great, ... -o also worked however it would be nice if -o showed a bit of context around the match (maybe 50 chars or so before and after), still useful all the same. Thanks again.