ripgrep 0.8.1
-SIMD -AVX
If you installed ripgrep with snap and are getting strange file permission or
file not found errors, then please do not file a bug. Instead, use one of the
Github binary releases.
Just using default arch package manager pacman.
uname -a
Linux archlinux 4.17.3-1-ARCH #1 SMP PREEMPT Tue Jun 26 04:42:36 UTC 2018 x86_64 GNU/Linux
I think it is juat a question, how could I merge the lines in the results? in current version, when I search text, sometimes I see two or more lines with same file path and line number ( they have different column), I hope rg can merge the results with same file path and line number.
*Why: *
I try to improve the flygrep.vim, which is a vim plugin, in the plugin I use a job to start rg, the stdout will trigger callback function. but vim script is too slow to parse and merge the lines, I hope rg can do it instead.
for more info see https://github.com/SpaceVim/SpaceVim/pull/1898
Sorry, but this question/bug report isn't actionable. I see no reproduction steps. I see no report of expected output or actual output. Please provide a ripgrep command, along with a corpus, that demonstrates what you're talking about.
If I had to guess, I'd say it sounds like you're specifically using a flag that causes ripgrep to emit a new line for every match. Such flags include --only-matching and --vimgrep. If you don't want that behavior, then don't use those flags.
@wsdjeg if you're trying to get the output format of --vimgrep but without the separate-line-per-match behaviour, i think you want this:
rg --color=never --no-heading --with-filename --line-number --column
e.g.:
% print -rl 'foobar foobaz' foobar baz |
\rg --vimgrep foo
<stdin>:1:1:foobar foobaz
<stdin>:1:8:foobar foobaz
<stdin>:2:1:foobar
% print -rl 'foobar foobaz' foobar baz |
\rg --color=never --no-heading --with-filename --line-number --column foo
<stdin>:1:1:foobar foobaz
<stdin>:2:1:foobar
Obviously then the column number corresponds to only the first match on the line.
Looking at this, it doesn't seem like you use the column number with any of your other search tools, so maybe you can just get rid of it entirely. On the face of it though it would seem ideal if your editor's search tool could take you to specific matches instead of just the first one on the line. idk, never used this
@okdana really thanks for your answer, that is what I needed.
@BurntSushi I am so sorry I do not follow the issue template.
This issue can be closed, and I need to find same answer for ag, pt, ack, and grep.
Most helpful comment
@wsdjeg if you're trying to get the output format of
--vimgrepbut without the separate-line-per-match behaviour, i think you want this:e.g.:
Obviously then the column number corresponds to only the first match on the line.
Looking at this, it doesn't seem like you use the column number with any of your other search tools, so maybe you can just get rid of it entirely. On the face of it though it would seem ideal if your editor's search tool could take you to specific matches instead of just the first one on the line. idk, never used this