Skip to content

Instantly share code, notes, and snippets.

@hSATAC
Created December 19, 2011 09:05
Show Gist options
  • Save hSATAC/1496197 to your computer and use it in GitHub Desktop.
Save hSATAC/1496197 to your computer and use it in GitHub Desktop.
runtime php syntax check without saving file
set errorformat=%m\ in\ %f\ on\ line\ %l
if !exists('*PHPsynCHK')
function! PHPsynCHK()
ccl
let winnum = winnr()
let linenum = line('.')
let colnum = col('.')
silent execute "%!php -l -f /dev/stdin | sed 's/\\/dev\\/stdin/".bufname("%")."/g' >.vimerr; cat"
silent cf .vimerr
cw
execute winnum . "wincmd w"
silent undo
silent cf
if 1 == len(getqflist())
call cursor(linenum, colnum)
endif
endfunction
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment