Tuesday, July 9, 2013

php syntax checking with vim

Showing off your cowboy skills by modifying PHP code on a production server with vim? Here's a neat trick to at least check the syntax of the modified file before saving it:
:w ! php -l
Or even save the above as a binding (ctrl-b) in your vimrc:
map <C-B> :w ! php -l<CR>
And a big thanks to http://vim.wikia.com/wiki/Runtime_syntax_check_for_php for making this so clear.