I am using ripgrep as external grep program in neovim. Which works when I call :grep 'pattern'
in neovim Command Mode.
I frequently have to search some strings within a blocked range in long json files (i do not want to search the entire file but only within a range).
I would love to know,
- If it is possible to use vim
:grep
with range ? - How can I use
:grep 'pattern' %
to search with a visually selected range only in the given file and not the entire file ?
I tried 15,82grep '^\s{8}\w+' %
but it does not respect the range provided and searches the pattern with in the entire files !!
:grep
does not work with range. It calls an external program and parses the output into the quickfix list. If I'm not mistaken, you want to pipe the visually-selected text to ripgrep and put the results in the qflist, right? That can be achieved by a custom function. But not by the standard:h :grep
and:h gp
system.