Vim plug-in for automatic PHP syntax checking, php syntax vim_PHP tutorial

WBOY
Release: 2016-07-13 10:21:03
Original
1393 people have browsed it

Vim plug-in for PHP syntax automatic checking, php syntax vim

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 :!php -l %, the syntax check can be performed immediately every time F5 is pressed. But I still feel a little uncomfortable, because many IDEs check in real time, and syntax errors will be prompted next to the line of code. Although real-time checking is not necessarily necessary, automatic checking is much more convenient than manual checking, such as automatically performing checks when the PHP file is saved.

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’

How to use vim to edit php language faster (automatic indentation)? How to set it up? ,,,

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

Why does VIM syntax highlighting disappear after saving the file?

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/861787.htmlTechArticleVim plug-in for automatic PHP syntax checking, php syntax vim. Since I write a lot of PHP recently, I occasionally make a mistake and write less. Syntax errors such as semicolons are inevitable. The general way to check is to return to the command line and run...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!