Created
April 4, 2014 16:15
-
-
Save mattboehm/9977950 to your computer and use it in GitHub Desktop.
A mini-plugin to cycle through diffs of unstaged git changes by file (requires 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
nnoremap <silent> <leader>gm :tab split<CR>:Glistmod<CR> | |
nnoremap <silent> <c-s-j> :call g:DiffNextLoc()<CR> | |
nnoremap <silent> <c-s-k> :call g:DiffPrevLoc()<CR> | |
command! Glistmod only | call g:ListModified() | Gdiff | |
function! g:ListModified() | |
let old_makeprg=&makeprg | |
let old_errorformat=&errorformat | |
let &makeprg = "git ls-files -m" | |
let &errorformat="%f" | |
lmake | |
let &makeprg=old_makeprg | |
let &errorformat=old_errorformat | |
endfunction | |
function! g:DiffNextLoc() | |
windo set nodiff | |
only | |
lnext | |
Gdiff | |
endfunction | |
function! g:DiffPrevLoc() | |
windo set nodiff | |
only | |
lprevious | |
Gdiff | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment