Closed blueyed closed 12 years ago
I couldn't get that to work.
The current version on github supports a modified property. So you should be able to do something like this:
let g:checksyntax['php'].modified = 'php_modified'
let g:checksyntax['php_modified'] = {
\ 'exec': 'call checksyntax#PhpModified()',
\ 'efm': '%*[^:]: %m in %f on line %l',
\ 'okrx': 'No syntax errors detected in ',
\ }
" Based on http://vim.wikia.com/wiki/Runtime_syntax_check_for_php
function! checksyntax#PhpModified() "{{{3
...
endf
given that you can fill in the missing part for "..." :-)
I have found the following code in the vim wiki [1], which uses stdin to pass the buffer's content to the "php -l" process.
This method would certainly work with any other tool, because you could just create a real temporary file and pass this on.
I would say that an extra command should get used for this, like "CheckSyntaxUnsaved" (which is rather bad, but to get an idea).
Also please note that a method should be used which works on Windows, too, like using a temporary file or methods like "-" instead of "/dev/stdin".
1: http://vim.wikia.com/wiki/Runtime_syntax_check_for_php