Created
July 12, 2012 22:53
-
-
Save jeffmccune/3101652 to your computer and use it in GitHub Desktop.
Vim GitDiffCheck
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
" ~/.vim/plugin/gitdiffcheck.vim | |
" Open up whitespace errors in the Quickfix List | |
" Jeff McCune | |
" Shamelessly stolen from http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html | |
" | |
" Just run :GitDiffCheck 2.x | |
" | |
" this will check your current branch for against the 2.x branch | |
" which is useful if you want to know if you're about to merge in | |
" a pull request that contains a bunch of syntax errors. | |
function! GitDiffCheck(args) | |
let cmd = "git diff --check " . a:args | |
echo "running: " . cmd | |
let tmpfile = tempname() | |
let cmd = cmd . " > " . tmpfile | |
call system(cmd) | |
let efm_bak = &efm | |
set efm=%f:%l:%m | |
execute "silent! cgetfile " . tmpfile | |
let &efm = efm_bak | |
botright copen | |
call delete(tmpfile) | |
endfunction | |
command! -nargs=* -complete=file GitDiffCheck call GitDiffCheck(<q-args>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment