sodapopcan / vim-twiggy

Git branch management for Vim
280 stars 15 forks source link

Automatically open Twiggy besides the Fugitive Git Status #49

Open Andrej-Marsic opened 11 months ago

Andrej-Marsic commented 11 months ago

I'd like to have :Twiggy buffer open and close automatically together with the command :Git from fugitive.

What would be the suggested way to make this interaction?

sodapopcan commented 8 months ago

Sorry for the delay here—I haven't worked on Twiggy or written much vimscript in quite a while, so I don't have a very solid answer. The best I could come up with is:

  autocmd BufWinEnter fugitive://*
        \ if exists("b:fugitive_type") && b:fugitive_type ==# 'index' |
        \   call twiggy#Branch() |
        \ endif

This will open twiggy beside the fugitive status window at the same height. Simply calling Twiggy instead of twiggy#Branch() fails. Again, my head has been out of viml for a bit so I don't have good intuition as to why right now. Hopefully this works for you!