Skip to content

thoradam/vim-flow

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

cd ~/.vim/bundle
git clone git://github.com/facebook/vim-flow.git

Add this to your ~/.vimrc

  NeoBundleLazy 'facebook/vim-flow', {
            \ 'autoload': {
            \     'filetypes': 'javascript'
            \ }}

With Flow build step, using flow-bin

  NeoBundleLazy 'facebook/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 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.

FlowFindRefs <arg>

Find the number of references to <arg> within the project.

Configuration

g:flow#autoclose

If this is set to 1, the |quickfix| window opened when the plugin finds an error will close automatically.

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 = 0

Default 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/flow

g:flow#qfsize

Leave this as default to let the plugin decide on the quickfix window size.

About

A vim plugin for Flow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%