Hacker News new | ask | show | jobs
by usrbinbash 1641 days ago
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