Created
March 16, 2010 15:00
-
-
Save c9s/334054 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
" Git rebase helper for: | |
" git rebase --interactive | |
" | |
" L - view commit log | |
" p - pick | |
" e - edit | |
" s - squash | |
" r - reword | |
" D - delete | |
" | |
" Cornelius <[email protected]> | |
fun! RebaseLog() | |
let line = getline('.') | |
let hash = matchstr(line,'\(^\w\+\s\)\@<=\w*') | |
vnew | |
setlocal noswapfile | |
setlocal nobuflisted nowrap cursorline nonumber fdc=0 | |
setlocal buftype=nofile | |
setlocal bufhidden=wipe | |
let output = system(printf('git log -p %s^1..%s', hash,hash )) | |
silent put=output | |
silent normal ggdd | |
setlocal nomodifiable | |
setfiletype git | |
endf | |
fun! RebaseAction(name) | |
exec 's/^\w\+/'.a:name.'/' | |
endf | |
fun! g:initGitRebase() | |
nmap <silent><buffer> L :cal RebaseLog()<CR> | |
nmap <silent><buffer> p :cal RebaseAction('pick')<CR> | |
nmap <silent><buffer> s :cal RebaseAction('squash')<CR> | |
nmap <silent><buffer> e :cal RebaseAction('edit')<CR> | |
nmap <silent><buffer> r :cal RebaseAction('reword')<CR> | |
nmap <silent><buffer> d dd | |
endf | |
autocmd filetype gitrebase :cal g:initGitRebase() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment