您的位置:首页 > 编程语言 > PHP开发

让Vim支持PHP代码折叠、调试!

2005-07-02 07:46 671 查看
Vim 6.0 以上版本开始支持代码折叠.
其实 Vim 的 PHP 语法文件($VIMRUNTIME/syntax/php.vim) 已经支持PHP代码折叠,只是默认没有打开.
可以该文件开头处(注释后面)中加入:
----------
let php_folding = 1
----------
即可打开. 如果 该值为 2 将折叠所有的 { 和 } (包括 if ,for ,while 等语句的折叠).不过偶不太喜欢这样的.

调试.
在 $VIMRUNTIME/compiler 目录下建立 php.vim 文件. 其内容如下:
-----
" Vim compiler file
" Compiler: php
" Maintainer: Vital <vital@phpexpert.51.net>
" URL: http://phpexpert.51.net/~vital/vim/compiler/php.vim " Last Change: 2005 Jul 02

if exists("current_compiler")
finish
endif
let current_compiler = "php"

if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif

CompilerSet makeprg=php/ %

CompilerSet errorformat=%m/ in/ %f/ on/ line/ %l
------

打开一 PHP 文件.

键入 :make 即可运行 PHP程序了.
运行后.
键入 :cl 可以看到PHP运行的出错或警告信息.
键入 :cl! 可以看到PHP运行的所有结果.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: