Ⅰ. 插件描述
A vim plugin for FlowⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'flowtype/vim-flow-love-story'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'flowtype/vim-flow-love-story'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'flowtype/vim-flow-love-story'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/flowtype/vim-flow
Ⅳ. 文档说明
# vim-flow
A vim plugin for Flow.
- Adds completions to
omnifunc - Checks JavaScript files for type errors on save
Requirements
- Requires Flow to be installed and available on your path
- Requires the project to be initialised with
flow init - Requires JavaScript files to be marked with
/* @flow */or/* @flow weak */at the top
Installation
Pathogen
cd ~/.vim/bundle
git clone git://github.com/flowtype/vim-flow.git
NeoBundle
Add this to your ~/.vimrc
NeoBundleLazy 'flowtype/vim-flow', {
\ 'autoload': {
\ 'filetypes': 'javascript'
\ }}With Flow build step, using flow-bin
NeoBundleLazy 'flowtype/vim-flow', {
\ 'autoload': {
\ 'filetypes': 'javascript'
\ },
\ 'build': {
\ 'mac': 'npm install -g flow-bin',
\ 'unix': 'npm install -g flow-bin'
\ }}Usage
Unless disabled manually, vim-flow will check JavaScript and JSX files on save.
Commands
FlowMake
Triggers a type check for the current file.
FlowToggle
Turns automatic checks on save on or off.
FlowType
Display the type of the variable under the cursor.
FlowJumpToDef
Jump to the definition of the variable under the cursor.
Configuration
g:flow#autoclose
If this is set to 1, the quickfix window will not be opened when there are
no errors, and will be automatically closed when previous errors are cleared.
Default is 0.
g:flow#enable
Typechecking is done automatically on :w if set to 1.
To disable this, set to 0 in your ~/.vimrc, like so:
let g:flow#enable = 0Default is 1.
g:flow#errjmp
Jump to errors after typechecking if set to 1.
Default is 0.
g:flow#flowpath
Leave this as default to use the flow executable defined on your path. To use
a custom flow executable, set this like so:
let g:flow#flowpath = /your/flow-path/flowg:flow#omnifunc
By default omnifunc will be set to provide omni completion. To disable it
(prevent overwriting an existed omnifunc), set this value to 0:
let g:flow#omnifunc = 0g:flow#timeout
By default timeout will be set to 2 seconds. If you are working on a larger
codebase, you may want to increase this to avoid errors when Flow initializes.
let g:flow#timeout = 4g:flow#qfsize
Leave this as default to let the plugin decide on the quickfix window size.
g:flow#showquickfix
By default, results are shown in a quickfix window. Setting this to 0 will
stop the window from being shown. This is useful if you want to use
vim-flow for the omnicomplete functionality, but are already using
something like ale.
let g:flow#showquickfix = 0