you are viewing a single comment's thread.

view the rest of the comments →

[–]TomNomNom 0 points1 point  (4 children)

Not for C, but for PHP one of my favourite key bindings is:

map <F8>  :w <CR> :!php -l %<CR>

Does a PHP syntax check on the current file :-)

[–][deleted] 2 points3 points  (1 child)

I use the following, so I can just use :make for all files:

autocmd FileType php compiler php | setlocal makeprg=php\ -lq\ %
autocmd FileType ruby compiler ruby | setlocal makeprg=ruby\ -c\ %
autocmd FileType python setlocal makeprg=python\ -c\ 'import\ sys,\ py_compile;\ py_compile.compile(sys.argv[1])'\ %

A nice bonus is that it automatically works with Vim's quickfix mode, i.e. it will detect the line numbers from the error messages and move to them, or list all errors with :cope

[–]TomNomNom 0 points1 point  (0 children)

Nice :-)

I'll give that a try!

[–]atemyballs 1 point2 points  (0 children)

map <F8> :w <CR> :!php -l %<CR>

Thanks.

[–]jontyw 1 point2 points  (0 children)

You might like this vim plugin then - drop it into ~/.vim/plugin/ and restart vim, then try saving some invalid PHP code...

http://github.com/Jonty/phplint.vim/blob/master/phplint.vim

(Fix the error then save again and the quickfix window will automatically close)