Ⅰ. 插件描述
autoflake plugin for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'tell-k/vim-autoflake'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'tell-k/vim-autoflake'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'tell-k/vim-autoflake'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/tell-k/vim-autoflake
Ⅳ. 文档说明
========================
vim-autoflake
vim-autoflake is a Vim plugin that applies autoflake to your current file.
autoflake remove unused imports and unused variables as reported by pyflakes.
Required
autoflake <https://pypi.python.org/pypi/autoflake>_
Installation
Simply put the contents of this repository in your ~/.vim/bundle directory.
Documentaion(Read The Docs)
Usage
shortcut
- Open Python file.
- Press <F9> to run autoflake on it
call function
::
:Autoflake
Customization
If you don't want to use the <F9> key for autoflake, simply remap it to
another key. It autodetects whether it has been remapped and won't register
the <F9> key if so. For example, to remap it to <F3> instead, use:
::
autocmd FileType python map <buffer> <F3> :call Autoflake()<CR>
To allow autoflake to remove additional unused imports (other than than those from the standard library), use the autoflake_imports option. It accepts a comma-separated list of names.
::
let g:autoflake_imports="django,requests,urllib3"
Remove all unused imports (whether or not they are from the standard library).
::
let g:autoflake_remove_all_unused_imports=1
Remove unused variables,
::
let g:autoflake_remove_unused_variables=1
Disable show diff window
::
let g:autoflake_disable_show_diff=1