Ⅰ. 插件描述
A lightweight PHPUnit runner for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'jonyamo/phpunit-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'jonyamo/phpunit-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'jonyamo/phpunit-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/jonyamo/phpunit.vim
Ⅳ. 文档说明
# phpunit.vim
A lightweight PHPUnit runner for Vim
Installation
If you do not have a preferred method, here are some suggestions:
git clone https://github.com/jonyamo/phpunit.vim ~/.vim/bundle/phpunit.vim
NeoBundleLazy 'jonyamo/phpunit.vim', {'autoload':{'filetypes':['php']}}
Bundle 'jonyamo/phpunit.vim'
Usage
Run Current File
To run all tests from the file located in the current buffer:
:PHPUnitRunCurrentFile
Run Current Test
To run a specific test, move the cursor to the test definition, then:
:PHPUnitRunCurrentTest
Run Previous Test
To run the previously run test again:
:PHPUnitRunPreviousTest
Configuration
By default, g:phpunit_command is set to phpunit {test}. This may be
modified to execute a custom command.
For example, to run with
dispatch.vim:
let g:phpunit_command = "Dispatch phpunit {test}"
Suggested Key Mappings
No keys are mapped by default, however, here are some suggestions:
nnoremap <leader>pf :call PHPUnitRunCurrentFile()<cr>
nnoremap <leader>pt :call PHPUnitRunCurrentTest()<cr>
nnoremap <leader>pp :call PHPUnitRunPreviousTest()<cr>