1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-08-04 21:52:54 +02:00

Should show filename for one file with vimgrep

With vim configured with:

    set grepprg=rg\ --vimgrep
    set grepformat^=%f:%l:%c:%m

and running the command `:grep 'vimgrep' doc/rg.1`, the output should
be:

    doc/rg.1:446:8:.B \-\-vimgrep

but the actual output was:

    446:8:.B \-\-vimgrep

Same issue would happen if results only match one file. Ag behaves as
expected.
This commit is contained in:
Eric Nielsen
2017-05-24 19:43:31 -05:00
committed by Andrew Gallant
parent d1bbc6956b
commit 1e3fc79949

View File

@ -532,6 +532,7 @@ impl<'a> ArgMatches<'a> {
false
} else {
self.is_present("with-filename")
|| self.is_present("vimgrep")
|| paths.len() > 1
|| paths.get(0).map_or(false, |p| p.is_dir())
}