Ⅰ. 插件描述
Expand require() statements in JavaScriptⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'rstacruz/vim-node-import'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'rstacruz/vim-node-import'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'rstacruz/vim-node-import'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/rstacruz/vim-node-import
Ⅳ. 文档说明
# vim-node-import
r fs⏎Turns into:
const fs = require('fs')Also:
r path → const path = require('path')
r ../setup → const setup = require('../setup')
r path.join → const join = require('path').join
r React → const React = require('react')
v path → var path = require('path')
i path → import path from 'path'
i path.join → import { join } from 'path'Semicolons are added if any other line in your buffer ends in a semicolon.
Install
When using [vim-plug], add this to your ~/.vimrc:
Plug 'rstacruz/vim-node-import'By the way
This plugin works swimmingly with [vim-closer], which, if you write JavaScript, you should also have.
Thanks
vim-node-import © 2015+, Rico Sta. Cruz. Released under the [MIT] License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com ·
GitHub @rstacruz ·
Twitter @rstacruz