Closed gennaro-tedesco closed 2 years ago
It's a little complicated.
Here is the definition of :BCommits
:
https://github.com/junegunn/fzf.vim/blob/a4ce66d72508ce7c626dd7fe1ada9c3273fb5313/plugin/fzf.vim#L66
:BCommits
in visual mode), we call the function with <line1>,<line2>
range
<line1>
and <line2>
translate to a:firstline
and a:lastline
respectivelya:firstline
and a:lastline
are set to the current line, so you only get the commits that have modified the current line:BCommits
has -range=%
attribute
:help :command-range
for more infoApologies for re-opening an old and closed issue: I am currently using the definition of BCommits
that you outlined above, namely
command! -bar -bang -range=% BCommits let b:fzf_winview = winsaveview() | <line1>,<line2>call fzf#vim#buffer_commits(fzf#vim#with_preview({'options': '--prompt "logs:"', 'down': '15'}), <bang>0)
and I would like to accompany it with a preview showing the patch of the selected commit. Whilst passing any argument to --preview=...
(and actually even without specifying --preview=...
at all) I see the exception
File not found <commit hash>
I suppose what happens is that fzf#vim#with_preview
directly invokes the preview of the current file and at most replaces it with the content under the cursor (which in the example at hand are the buffer commit hashes). Notice that here I would like to explicitly pass a --preview
to BCommits
because otherwise I have let g:fzf_preview_window = []
.
the former probably working with general options for preview, the latter should be the solution but it still does not work in my case.
man fzf
)Is
:call fzf#vim#buffer_commits()
not the same as invoking:BCommits
? In particular I noticed that the latter does not show the buffer commits at all (only the latest): see below reproducible example:then we see
https://user-images.githubusercontent.com/15387611/148083070-36961a99-3287-4162-a4cb-ecd9345bc02f.mov
namely
BCommits
shows all commits,fzf#vim#buffer_commits()
does not. Apologies if this is trivially states somewhere I missed.