Ⅰ. 插件描述
Jasmine Plugin for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'claco/jasmine-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'claco/jasmine-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'claco/jasmine-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/claco/jasmine.vim
Ⅳ. 文档说明
- Vim Plugin for Jasmine javascript testing
This is my first attempt at a vim plugin bundle. I'm sure there are dragons in here. :-)
- Installation
I'm currently using Pathogen and am assuming you are too. That means you should be able to do:
- git clone git://github.com/claco/jasmine.vim.git bundle/jasmine
inside of your ~/.vim directory. If you're using submodules to track your bundles:
- git submodule add git://github.com/claco/jasmine.vim.git bundle/jasmine
- submodule init
git submodule update
- What it does
This plugin is pretty basic right now. It currently:
- Sets Spec.js and SpecHelper.js files to filetype=jasmine.javascript syntax=jasmine
- Sets Spec.coffee and SpecHelper.coffee files to filetype=jasmine.coffee syntax=jasmine
- Applies basic syntax highlighting for jasmine keywords in addition to normal javascript syntax
- Loads snippets for the jasmine filetype for:
** desc: description block with before..it..expect
** before: beforeEach block
** after: afterEach block
** it: it...expect block
** helper: beforeEach block and addMatcher/matcher blocks for SpecHelper.js
** matcher: matcher block for SpecHelper.js
** expect: expect..to line
** spy: spyOn method
- Uses templates for new jasmine buffers
- Runs all specs in jasmine:ci and shows Red/Green bar
You can disable templating by setting g:jasmine_use_templates=""
By default, the plugin assumes the templates are in bundle/jasmine/template and the snippets are in bundle/jasmine/snippets. You can override those by setting g:jasmine_snippets_directory and g:jasmine_templates_directory in your vimrc
- Running Specs
I'm slowly working on interactive spec running support. Currently, the Jasmine() command is provided for jasmine buffers. When invoked, it searches the current/parent directories of that buffer for the nearest Rakefile and invokes rake jasmine:ci to run all specs.
Jasmine buffers now have compiler set to the jasmine compiler and leader-m is mapped to run :Jasmine -> jasmine#run_tests -> :make -> rake jasmine:ci
If the specs fail, the bottom buffer status turns Red. If all specs pass, the status turns Green.
I plan on adding quickfix error support.
- TODO
- Add commands/functions to run a spec, a spec file
- Add QuickFix error buffer support
- docs help file