-
Notifications
You must be signed in to change notification settings - Fork 25
Custom Commands
Put custom commands in an autogroup
in your .vimrc
, like so:
v1
augroup flog
autocmd FileType floggraph nno <buffer> x :<C-U>call flog#run_command('command goes here')<CR>
" etc.
augroup END
v2+
augroup flog
autocmd FileType floggraph nno <buffer> x :<C-U>call flog#Exec('command goes here')<CR>
autocmd FileType floggraph nno <buffer> x :<C-U>exec flog#Format('command goes here')<CR>
" etc.
augroup END
This will create a fixup commit for the commit under the cursor in normal mode when pressing cf
.
Fixup commits are automatically applied to other commits when running git rebase --autosquash
.
v1
autocmd FileType floggraph nno <buffer> cf :<C-U>call flog#run_command('Git commit -m "fixup! %h"', 0, 1)<CR>
v2+
autocmd FileType floggraph nno <buffer> cf :<C-U>exec flog#Format('Floggit commit -m "fixup! %h"')<CR>
This will reset to the selected commit using --mixed
with cv
, and using --hard
with cV
.
v1
autocmd FileType floggraph nno <buffer> cv :<C-U>call flog#run_command("Git reset --mixed %h", 0, 1)<CR>
autocmd FileType floggraph nno <buffer> cV :<C-U>call flog#run_command("Git reset --hard %h", 0, 1)<CR>
v2+
autocmd FileType floggraph nno <buffer> cv :<C-U>exec flog#Format("Floggit reset --mixed %h")<CR>
autocmd FileType floggraph nno <buffer> cV :<C-U>exec flog#Format("Floggit reset --hard %h")<CR>
This changes the cm
binding to automatically merge the first local branch under the cursor with the --no-ff
binding.
v1
autocmd FileType floggraph nno <buffer> cm :<C-U>call flog#run_command('Git merge %l --no-ff', 0, 1)<CR>
v2+
autocmd FileType floggraph nno <buffer> cm :<C-U>exec flog#Format('Floggit merge %l --no-ff')<CR>
By default ]r
/[r
opens a split after jumping.
This disables that behaviour.
v1
autocmd FileType floggraph nno <buffer> <silent> ]r :<C-U>call flog#next_ref()<CR>
autocmd FileType floggraph nno <buffer> <silent> [r :<C-U>call flog#previous_ref()<CR>
v2+
This is the default behavior in v2+.
Use cuo
to set the selected branch's upstream to origin
. Mnemonic: change upstream origin.
Use cu<Space>
to populate the command line with Floggit branch --set-upstream-to<Space>
. Mnemonic: change upstream.
v2+
au FileType floggraph nno <buffer> cuo :<C-U>exec flog#Format("Floggit branch --set-upstream-to origin %l")<CR>
au FileType floggraph nno <buffer> cu<Space> :<C-U>Floggit branch --set-upstream-to<Space>