Ⅰ. 插件描述
A powerful vim plugin lint javascript code on the flyⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/jsflakes-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/jsflakes-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/jsflakes-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/jsflakes.vim
Ⅳ. 文档说明
Watch live video: http://michalliu.github.com/jsflakes.vim/jsflakes.html
For javascript file, jsflakes will automaticlly check errors in your code while you editing.
If you don't like this behaviour. You can toggle the Automatic Lint by <Leader>al , your vim's <Leader> is often .
The command to run jshint manaually is
:JSHint
The current errors are added to the window's location list. You can aslo use quickfix commands, like
:lli list errors in your javascript code
:lopen open location window
Advance Usage
Jsflakes aslo support html file, add following to your vimrc
au FileType html source $VIMvimfilesftpluginjavascriptjsflakes.vim
Jsflakes use jslint to check errors. Jslint has many options, Jslint option file should be at ~/.jshintrc by default. your can change it to other location by adding following line to your vimrc
let g:jshint_rcfile = {PATH}
Jsflakes aslo provide commands to run javascript directly inside VIM
RunJS
:RunJS run javascript code
RunJSBlock
:RunJS 1,2 run javascript code from line 1 to line 2
RunHtml
:RunHtml run html code
RunHtmlBlock
:RunHtmlBlock 1,2 run html code from line 1 to line 2