python-imports.vim : Scripted insertion of import statements
script karma |
Rating 1/5,
Downloaded by 1180 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Phillip Berndt |
|
script type |
ftplugin |
|
description |
This plugin automates the insertion of import statements at the top of a python script. It contains a function capable of adding import statements at the top of the file. This function is mapped to <C-f>. So you can for example type "sys.exit<C-f>" and the plugin will append "import sys" above the other import statements at the top of the file, unless sys already was imported. The script tries to maintain the import statements in order.
If you define
let g:PythonAutoAddImports = 1
in your vimrc, this script will additionally hook into the period key, such that for common modules,
imports are added as you type: Typing
if len(sys.argv) == 0:
into an empty file will leave you with
import sys
if len(sys.argv) == 0:
then.
This plugin is in its early stages. Also, it is my first vim plugin, so do not expect everything to run smoothly yet. I maintain this script an vim repo at github:
https://github.com/phillipberndt/python-imports.vim |
|
install details |
Copy python.vim into your ~/.vim/ftplugin folder. If you use Pathogen, create a directory ~/.vim/bundle/vim-python-imports/ftplugin and copy it there. |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.97.14.83
|