Re:Ask HN: Working with large code base for the first time
by gorgonzolachz on Wednesday December 22, 2021 @03:14AM
(#29646727)
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.
[ Parent
| on HN ]
Re:Ask HN: Working with large code base for the first time
by akiselev on Wednesday December 22, 2021 @03:29AM
(#29646812)
VSCode uses ripgrep under the hood [1]
Re:Ask HN: Working with large code base for the first time
by usrbinbash on Wednesday December 22, 2021 @05:49AM
(#29647674)
Almost 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
Re:Ask HN: Working with large code base for the first time
by foobarbaz33 on Wednesday December 22, 2021 @08:50PM
(#29657784)
What 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.