vim-import-js


Ⅰ. 插件描述

Vim plugin for ImportJS

Ⅱ. 基本信息

创建日期:  2016-04-12
使用用户:  4
Github星:  138
插件作者:  Galooshi

Ⅲ. 安装方法

使用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.

Demo of ImportJS in action

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-js

Dependencies

ImportJS works in Vim (version 8 and later) and
Neovim.

You need import-js installed globally to use this plugin.

npm install -g import-js

Default mappings

By default, ImportJS attempts to set up the following mappings:

MappingCommandDescription
<Leader>j:ImportJSWordImport the module for the variable under the cursor.
<Leader>i:ImportJSFixImport any missing modules and remove any modules that are not used.
<Leader>g:ImportJSGotoGo 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.

添加新评论