python_import.vim : automatically remove unused imports and clean up the rest
script karma |
Rating 8/2,
Downloaded by 967 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Jason Lunz |
|
script type |
ftplugin |
|
description |
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. |
|
install details |
Just drop the file in ~/.vim/ftplugin.
vim must be compiled with +python. |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 52.14.221.113
|