I followed some tutorials to debug and lint php code through VIM.
Here is my piece of PHP code to test
<?php echo "test" echo "test2";?>
The following code worked for me:
:autocmd FileType php noremap <C-L> :!$HOME/bin/php -l %<CR>
It tells me that there is a syntax error.
Problem is that i want to use the quickfix console. So, here is the code:
set makeprg="php -l %"
nmap <F9>:make<ENTER>:copen<ENTER><CTRL>L
F9 opens the quickfix window, but detects no syntax error. (I save my php document before with :w)
Thanks for your time !
The problem i see is using
"w/:set. I suggest the following:To make this a bit more friendly with other file types I suggest you put the following in your ~/.vim/after/ftplugin/php.vim and making sure you use
:setlocaland your mappings have<buffer>attribute like this: