Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think you can. You pipe to `vim`, and it will open a buffer with the contents. I am not sure if it will pipe out, though.

Edit: I've now tried it myself with `rep`.

It's not automatic, unfortunately. You can use `vipe` (part of moreutils on my machine) to pipe into vim (or any `$EDITOR`) and to pipe the result out.

However, `rep` wants a pager. If you run `vim` with `rep` at the end of the pipeline, everything gets garbled because `rep` (well, the pager) is the one taking key presses.

To get around this, you can pipe `rep` to something else. I piped it to `cat -`, which forced it into outputting to `stdout`.

So my final command looked like this:

    rg --no-heading --with-filename --line-number "\bstatic inline\b" include/ src/ tests/ \
        | vipe | rep inline y_cinline | cat -
Make sure your `$EDITOR` variable is set correctly for `vipe`.

Anyway, I'm going to add a PR to `rep` to add a command-line flag to output to stdout without a pipe. If it is accepted, that should help.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: