Ⅰ. 插件描述
Simple Vim wrapper for Babeljs CLIⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'tbrisbout/vim-babeljs'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'tbrisbout/vim-babeljs'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'tbrisbout/vim-babeljs'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/tbrisbout/vim-babeljs
Ⅳ. 文档说明
# Vim Babeljs
This Plugin is in alpha state
This plugin is a simple wrapper for the babeljs.io transpiler.
Setup
This plugin is Pathogen-compatible, so install it simply with your favorite Plugin Manager
" Example with Vundle
Plugin 'tbrisbout/vim-babeljs'Dependencies
You must have babeljs-cli installed and available in your $PATH
You can install it with
npm install -g babel-cliYou also need babel-preset-es2015 installed (it can be installed locally)
npm install babel-preset-es2015Usage
You have the :Babel command to compile a javascript file (js and es6 extensions are supported)
This opens a new buffer with the output of the transpiled file
Configuration
The following configuration is available:
" Babel executable if not in $PATH
let g:babeljs_command = "/path/to/babel"
" Presets (defaults to es2015)
let g:babeljs_presets = "react"