Rip doesn't return a number line in vim system()? #1780
-
Hello, when in vim I can use grep and get the expected result but I can't use rip grep and get the same result. When I do it on the shell rip grep works fine and returns 8882 but not in vim. I'm trying to get a line number where the pattern was found and put it in a vim variable or register. This works let @*=system("grep -n '^setpos' '/usr/local/share/vim/vim82/doc/tags' ")
"Output --> 8882:setpos() eval.txt /*setpos()* This does not work. No number. let @*=system("rg '^setpos' '/usr/local/share/vim/vim82/doc/tags'")
"Output --> setpos() eval.txt /*setpos()* For now I'm just using grep on this part of the code. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Use When ripgrep is run with a tty, it automatically enables certain options like colors, line numbers and file headings. But when without a tty (like inside vim), it runs more like grep. So just pass the flags you need. |
Beta Was this translation helpful? Give feedback.
Use
-n
, just like grep.When ripgrep is run with a tty, it automatically enables certain options like colors, line numbers and file headings. But when without a tty (like inside vim), it runs more like grep. So just pass the flags you need.