I use vim/gvim for my text editor and I found a handy way to quickly check PHP syntax using a couple of keystrokes from within the editor. Add this to your vimrc file:
" Check php syntax on the current file with CTRL+L
autocmd FileType php noremap <C-L> :!/usr/bin/php -l %<CR>
As an added bonus, you can also use a key mapping to run the execute the PHP file as well, though I find this less useful on a daily basis.
" Run php cli on the current file with CTRL+M
autocmd FileType php noremap <C-M> :w!<CR>:!/usr/bin/php %<CR>
You can change the key used to trigger the command, but you have to be careful not to interfere with pre-existing key combinations.
No comments:
Post a Comment