Created
April 1, 2011 03:49
-
-
Save frogonwheels/897695 to your computer and use it in GitHub Desktop.
Add a git sign-off message using fugitive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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