3 ms·
I love ag and use it daily. One problem I constantly run into is searching for something and getting minified JavaScript in the results which is unreadable and
by Touche 11y ago
I love ag and use it daily. One problem I constantly run into is searching for something and getting minified JavaScript in the results which is unreadable and eats up all scrollable space in my terminal. I'd like to ignore all files with super-long lines in them, any options for this sort of problem?
- lancefisher 11y agoIt doesn't ignore long lines, but you can use the .agingore file to ignore *.min.js, node_modules, and other patterns. https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage https://github.com/ggreer/the_silver_searcher/wiki/Advanced-...
- mborch 11y agoJust add these to your .gitignore/.hgignore/.agignore file.
- Touche 11y agoThat's not practical, I don't know the name of every minified file as there could be a lot of them packaged with dependencies.
- z1mm32m4n 11y agoWow, I had never thought about that. I've run into issues with minified JavaScript files as well, but never really thought about how much it annoyed me. To "ignore" super-long lines, we can just use a Unix filter: ag --color --group <pattern> | cut -c -100 the --color and --group force ag to not change the output just because we're piping the output to something that isn't a tty. The cut command simply clamps all lines at 100 chars; feel free to change this length. This is pretty long, so we could write a wrapper function or something: agc() { ag --color --group $@ | cut -c -100 } Stick it in your zshrc and you're good to go.
- Touche 11y agoPerfect, thank you.