Ⅰ. 插件描述
Vim plugin for ImportJSⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'galooshi/vim-import-js'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'galooshi/vim-import-js'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'galooshi/vim-import-js'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/galooshi/vim-import-js
Ⅳ. 文档说明
ImportJS helps you import JavaScript dependencies. Hit a keyboard shortcut
to automatically add import x from 'y' statements at the top of the file.

Installation
ImportJS is meant to be used as a Pathogen plugin. Just git clone this repo
into the bundles folder and you are good to go!
git clone git@github.com:Galooshi/vim-import-js.git ~/.vim/bundle/vim-import-jsDependencies
ImportJS works in Vim (version 8 and later) and
Neovim.
You need import-js installed globally to use this plugin.
npm install -g import-jsDefault mappings
By default, ImportJS attempts to set up the following mappings:
| Mapping | Command | Description |
|---|---|---|
<Leader>j | :ImportJSWord | Import the module for the variable under the cursor. |
<Leader>i | :ImportJSFix | Import any missing modules and remove any modules that are not used. |
<Leader>g | :ImportJSGoto | Go to the module of the variable under the cursor. |
Configuration
For import-js configuration see https://github.com/Galooshi/import-js#configuration
Troubleshooting
If you run into issues when using the plugin, adding some logging can help.
After starting up vim, and before you've imported anything, run this command:
:call ch_logfile('channel_log.txt', 'w')After this, you should get useful information in channel_log.txt.