4 ms·
2 and 3 are great points, but honestly - and especially if you're working in multiple repos, or multiple subdirectories in a monorepo - VS code's folder search
by gorgonzolachz 5y ago
2 and 3 are great points, but honestly - and especially if you're working in multiple repos, or multiple subdirectories in a monorepo - VS code's folder search is better than grep. It'll find you the exact place in the file, and a click will take you there, nice and easy. I've more or less forgotten the quirks/flags of grep, because I haven't needed to use it in a while.
- akiselev 5y agoVSCode uses ripgrep under the hood [1] [1] https://github.com/microsoft/vscode-ripgrep https://github.com/microsoft/vscode-ripgrep
- usrbinbash 5y agoAlmost the same can be achieved in vim even without plugins :tabnew | r ! shopt -o globstar && grep -sn STRING ** This opens a new tab with the grepped output. I simply navigate to the line so my cursor is on the filename, then C-w gf That's [Ctrl-W] followed by [g] and [f] And just like that, the file is open in yet another tab. The best part? Since the grep output is just another vim buffer, I can search it as well, just like any other buffer. And yes, ofc the above can be put into a custom command, just by putting this in the .vimrc: command -nargs=1 Gr :tabnew | r ! shopt -s globstar && grep -sn <args> ** Then the whole thing can be used like :Gr STRING
- foobarbaz33 5y agoWhat if I told you VS code search is ripgrep? Pretty much every coding focused editor has built-in ability to view grep results, then click on the result to jump to the file location. It's 1980's UI technology.