0

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:

enter image description here

How should I specify the --preview option in fzf.vim?

1
  • git log doesn't accept revisions from stdin; perhaps you need … | xargs git log …?
    – D. Ben Knoble
    Jun 7 at 15:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.