vim-sort-imports


Ⅰ. 插件描述

vim port of import-sort. Sort javascript/typescript imports

Ⅱ. 基本信息

创建日期:  2017-10-20
使用用户:  15
Github星:  18
插件作者:  Yulong Ruan

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'ruanyl/vim-sort-imports'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'ruanyl/vim-sort-imports'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'ruanyl/vim-sort-imports'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/ruanyl/vim-sort-imports

Ⅳ. 文档说明

vim-sort-import

vim-sort-import

Please refer to import-sort for more details

Config example:

// enable auto sort import on write
let g:import_sort_auto = 1

// install import-sort packages
npm install --save-dev import-sort-cli import-sort-parser-babylon import-sort-parser-typescript import-sort-style-renke

// package.json:
"importSort": {
  ".js, .jsx, .es6, .es": {
    "parser": "babylon",
    "style": "renke"
  },
  ".ts, .tsx": {
    "parser": "typescript",
    "style": "renke"
  }
}

Available CMD

// run import-sort against current buffer
:SortImport

// start run import-sort on save
:StartAutoSortImport

// stop run import-sort on save
:StopAutoSortImport

添加新评论