让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运行的所有结果.
其实 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运行的所有结果.
相关文章推荐
- 在vim中 安装php的xdebug和 vdebug插件, 在vim中进行调试php代码
- Vim + VundleVim + VDebug 来支持 XDebug 调试 PHP(7分钟)
- Vim使用XDebug支持Php调试
- Notepad++ 配置 支持jquery、html、css、javascript、php代码提示
- Notepad++ 配置 支持jquery、html、css、javascript、php代码提示
- PHPStorm + Xdebug 调试PHP代码 有大用
- PHP读取文件并可支持远程文件的代码分享
- php 广告调用类代码(支持Flash调用)
- Linux 环境使用vim搭建php IDE -- 提高代码编写数度数倍!手把手教你打造程序员的上古神器VIM!
- vim之代码折叠
- PHP5.3不支持zend debugger, 安装Xdebug调试工具
- 【gvim】vim 代码折叠
- vim代码折叠
- php支持分块与断点续传文件下载功能代码
- VIM 代码折叠
- php检测服务器是否支持gzip代码
- php调试代码
- centos下 使用phpstorm+xdebug 远程调试代码
- vim php代码规范