PHP syntax Auto Check vim plugin _php instance

Source: Internet
Author: User

As a result of the recent write PHP more, occasionally hand mistakenly write a semicolon and so on grammatical errors unavoidably, the general check way is to return to the command line to run Php-l, or upgrade the direct in vim run:!php-l%, or again this binding as shortcut keys, such as: Map <F5>:!php-l %<cr>, every time you press F5, you can perform a grammar check immediately. But still feel slightly uncomfortable, because many Ides are checked in real time, syntax errors will be prompted next to the line of code. While real-time checking may not be necessary, automatic checking is more convenient than manual checking, such as automatically performing checks when PHP files are saved.

So wrote this Phpcheck.vim plug-in, the basic function is to save the PHP file syntax check, there are errors will be prompted, no error will not have any hint. Most of the time will not be able to see the effect of this plug-in, but occasionally the hand mistakenly appear syntax errors, you will see the hint.

The error message is shown in the following illustration:

The error message contains error messages and error line numbers.

Plugin download

http://www.vim.org/scripts/script.php?script_id=4984
Plug-in installation

Put the downloaded Phpcheck.vim in your

~/.vim/plugin/

or vim in the installation path of the plugin/.

Plug-in configuration

Most of the cases are not configured. If your Phpbin directory is not in the system's environment variable, you can specify the path to the Phpbin, as follows:

Let G:php_syntax_check_bin = '/apps/php/bin/php '

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.