Closed tonebender closed 2 years ago
Because when you pass a file name to rg
, it stops printing the filename. The solution is to add --with-filename
.
$ rg --column --line-number --no-heading --color=always --smart-case foo | grep man1
man/man1/fzf.1:966:21: INITIAL_QUERY="foobar"
$ rg --column --line-number --no-heading --color=always --smart-case foo man/man1/fzf.1
966:21: INITIAL_QUERY="foobar"
$ rg --column --line-number --no-heading --color=always --smart-case --with-filename foo man/man1/fzf.1
man/man1/fzf.1:966:21: INITIAL_QUERY="foobar"
Great, that certainly makes sense! Thanks so much for the quick response!
man fzf
)If I search with :Rg "my search pattern" /path/file/to/search.txt, and results are found, the results (lines) will be listed in the left box as usual, but the preview window on the right will only say "File not found 1", where "1" is the line number where the match was found in the file (!).
If I do the same search without specifying an explicit path to Rg, like this: :Rg "my search pattern", it will find the match(es) and the preview will work as usual.
I have this custom Rg setup in my ~/.vimrc:
command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".<q-args>, 1, fzf#vim#with_preview(), <bang>0)
Any ideas why the preview doesn't work with Rg calls with path/file specified?