Home  >  Article  >  php教程  >  vim php语法检查

vim php语法检查

WBOY
WBOYOriginal
2016-06-06 19:54:051744browse

之前一直是editplus的忠实爱好者,对editplus的使用也是小有心得.自打转向到vim之后,费了很大劲才转换一些习惯,渐渐的脱离了editplus,可见一款趁手的编辑器还是粘性很强的.以前说到的editplus可以和zend studio自带的ZendCodeAnalyzer工具进行整合对php语法进

之前一直是editplus的忠实爱好者,对editplus的使用也是小有心得.自打转向到vim之后,费了很大劲才转换一些习惯,渐渐的脱离了editplus,可见一款趁手的编辑器还是粘性很强的.以前说到的editplus可以和zend studio自带的ZendCodeAnalyzer工具进行整合对php语法进行检测,相当方便.那么怎样用vim实现类似的功能呢?一番搜索,找到了答案:

<code><span>map </span><span><span>C</span><span>-</span><span>J</span><span>></span><span>:!</span><span>php </span><span>-</span><span>l </span><span>%<span>CR</span><span>></span></span></span></code>

这样在vim里面就可以直接用ctrl+j,调用php解析器对当前文档进行语法检查了.当然如果php解析器不在你的路径下的话,那么应该写上全路径,象下面这样:

<code><span>map </span><span><span>C</span><span>-</span><span>J</span><span>></span><span>:!</span><span>c</span><span>:</span><span>/php/</span><span>php </span><span>-</span><span>l </span><span>%<span>CR</span><span>></span></span></span></code>

PS:vim的语法美化功能也很方便,只要在程序的第一行,command模式下输入=:1,$,就可以把当前代码排列的井然有序.而editplus则需要另外的工具配合,也能做到这一点.

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