I'm trying to create neovim fzf command FzfGBranches
to use git branch -a
as query, and use git log --oneline
as fzf preview:
command! -bang -nargs=0 FzfGBranches
\ call fzf#vim#grep(
\ "git branch -a", 1,
\ fzf#vim#with_preview({
\ 'options': [
\ '--prompt', '*Branches> ',
\ '--bind', 'ctrl-d:page-down,ctrl-u:page-up',
\ ],
\ 'placeholder': "echo {} | rev | cut -d'*' -f1 | rev | git log --oneline --graph --date=short --color=always --pretty=\"format:%C(auto)%cd %h%d %s\"",
\ }), <bang>0)
When I call FzfGBranches
command, it show up and seems good, but when I press up
/down
keys, the preview (on the right side) does not refresh. See below screenshot:
How should I specify the --preview
option in fzf.vim?
git log
doesn't accept revisions from stdin; perhaps you need… | xargs git log …
?