I am wondering if this would be hard to implement something similar to https://github.com/aykamko/tag? I can try if you want. The principle is simple: Generate one alias per results in a temporary file (so e1 will open an editor to the first result —file and line—, e2 to the second result etc.; e.g. alias e1="$EDITOR +line file"), source the alias (done by the shell, not by the command itself), that's it.
The text was updated successfully, but these errors were encountered:
I don't think mucking about with shell aliases is something that belongs in ripgrep. It sounds like a maintenance nightmare. Does it work on Windows? Which shells does it support?
I would, however, be amenable to making ripgrep's output format a bit more customizable. However, that will require some refactoring/design work that I'm not quite ready to tackle yet. That particular issue is tracked by #244.
You can then just call rg2vim foobar. Peco will fire up and show you all files that contain foobar and the matching line obtained from rg. You can narrow it down within peco. Hit Enter and Vim will fire up at the exact matching line. Hold your breath in awe.
This has the virtue of opening multiple selected files in individual tabs and skipping peco if there is only one match reported by rg. It does a horrible (read:none) job of escaping special characters though. Maybe someone can come up with something better
I never got around to such details. The "script" does not process Ctrl-C and just falls on it's nose if there is no rg or peco binary at all. All I do with it is fire rg and see if something useful comes out at all and then use rg2vim !$ to redo the search and load the desired matches into vim.