Since I write a lot of PHP recently, it is inevitable to make grammatical errors such as missing a semicolon occasionally. The general way to check is to return to the command line and run php -l, or upgrade and run directly in Vim:!php -l %, or bind this as a shortcut key, such as: map
So I wrote this phpcheck.vim plug-in. Its basic function is to perform syntax check when saving PHP files. If there are errors, it will be prompted. If there are no errors, there will be no prompts. You may not see the effect of this plug-in most of the time, but occasionally you will see a prompt when a grammatical error occurs by mistake.
The error message is as shown below:
The error message contains error information and error line number.
Plug-in download
http://www.vim.org/scripts/script.php?script_id=4984
Plug-in installation
Put the downloaded phpcheck.vim into your
~/.vim/plugin/
or plugin/ in the Vim installation path.
Plug-in configuration
In most cases, there is no need to configure it. If the directory where your phpbin is located is not in the system environment variable, you can specify the path to phpbin as follows:
let g:PHP_SYNTAX_CHECK_BIN = ‘/apps/php/bin/php’
This should be because the PHP syntax file is missing. It is not a configuration problem. Check whether there is a PHP syntax file in the syntax folder
If possible, please send your vimrc[,gvimrc] file and the list of plug-ins you use. If nothing else, it should be a conflict in settings.