Ⅰ. 插件描述
automatically remove unused imports and clean up the restⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/python-import-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/python-import-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/python-import-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/python_import.vim
Ⅳ. 文档说明
This plugin defines a function for automatically cleaning up the imports
in a python module or program. It does two things:
- removes unused imports
- sorts and formats the remaining imports
This function is mapped to <LocalLeader>i (for "import") in two contexts.
In Normal mode, it operates on the current paragraph.
In Visual mode, it operates on the selected range.
The python 'tokenize' module is used to determine which symbols are used
in the current buffer, so the script is pretty good at identifying unused imports.
The import formatting style was chosen to work well with grep - the name of
the module and the symbols imported from it are guaranteed to always
appear on the same line.