vim-gina
vim-gina copied to clipboard
Have :gina branch open to master
I often use this plugin to view my branches on a very large repo, and it'd be really nice if there was an option to have it default to having the cursor vertically centered on master when the view opens up. This way you could quickly make new branches off of master.
Yeah I know you can make a branch of master quickly with the vim command line but I much prefer the visual workflow that gina provides to branches in git.
Not sure but does https://vim-jp.org/vimdoc-en/editing.html#+cmd helps you?
e.g.
:Gina +/master branch
Maybe :Gina branch +/master
I found that above tech does not work.
While gina read buffer content asynchronously, +/master is not available because there is no content just after :Gina branch.
You can use gina#core#emitter#subscribe() to subscribe command:called event like
function! s:on_branch(name, ...) abort
if a:name !=# 'branch'
return
endif
let params = gina#core#buffer#parse(expand('%'))
if empty(params) || params.scheme !=# 'branch'
return
endif
" Find 'master' and move.
/master
endfunction
call gina#core#emitter#subscribe(
\ 'command:called',
\ funcref('s:on_branch')
\)
Thanks @lambdalisue. That function works great. I think other people would really appreciate this, maybe this could work its way into master somehow?