search
Homephp教程php手册PHP语法自动检查的Vim插件,php语法vim

PHP语法自动检查的Vim插件,php语法vim

由于最近写PHP比较多,偶尔手误少写个分号之类的语法错误难免,一般的检查方式是回到命令行运行 php -l ,或者升级一下直接在Vim里运行 :!php -l % ,或者再将此绑定为快捷键,如 :map :!php -l % ,每当按F5便可立即执行语法检查。但还是觉得略有不爽,因为很多IDE是实时检查的,语法错误会提示在代码行的旁边。虽然实时检查未必有必要,但自动检查要比手动检查方便的多,比如在php文件保存时自动执行检查。

于是写了这个 phpcheck.vim 插件,基本功能就是 在PHP文件保存时进行语法检查,有错误会提示出来,没错误不会有任何提示。 可能大部分时候都不会看不到这个插件的效果,只是偶尔手误出现语法错误时,会看到提示。

错误提示如下图所示:

错误提示包含错误信息和错误行号。

插件下载

http://www.vim.org/scripts/script.php?script_id=4984
插件安装

将下载的phpcheck.vim放入你的

~/.vim/plugin/

或Vim安装路径里的plugin/。

插件配置

大部分情况下是不用的配置的。如果你的phpbin所在目录不在系统的环境变量的话,可以指定phpbin的路径,如下:

let g:PHP_SYNTAX_CHECK_BIN = ‘/apps/php/bin/php'

怎使用vim编辑php语言比较快(自动缩进)?怎设置?、、、

这个应该是少了php的语法文件,不是配置的问题检查下syntax文件夹里是否有php的语法文件
 

VIM语法高亮在保存文件后消失是为何?

可以的话发一下你的vimrc[,gvimrc]文件,还有你使用的插件列表,不出意外应该是设置冲突。
 

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.