Skip to content

Instantly share code, notes, and snippets.

@frogonwheels
Created April 1, 2011 03:49
Show Gist options
  • Save frogonwheels/897695 to your computer and use it in GitHub Desktop.
Save frogonwheels/897695 to your computer and use it in GitHub Desktop.
Add a git sign-off message using fugitive
fun! AddGitSign()
let idx=line('$')
while idx > 0 && getline(idx) =~ '^#'
let idx-=1
endwhile
let sign=['Signed-off-by: '.fugitive#buffer().repo().user()]
if idx == 0 || getline(idx) != ''
call insert(sign,'')
endif
call append(idx, sign)
endfun
aug MRGGit
au!
au FileType gitcommit map <buffer> <silent> <localleader>si :call AddGitSign()<CR>
au FileType gitcommit iabbrev <buffer> <silent> <expr> sign-- ((getline(line('.')-1)=~'^\s*$')?'':"\<CR>").
\ 'Signed-off-by: '.fugitive#buffer().repo().user()
aug END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment