/vim-autoimport

A vim plugin for adding import statements (for python and more) without LSP

Primary LanguagePython

vim-autoimport

A vim plugin for easily adding import statements.

This is still WIP --- things might change rapidly.

Usage

Currently only works for python. You need to have has('python3') enabled.

Commands:

:ImportSymbol             " Add an import statement for the current symbol
:ImportSymbol np.zeros    " Add an import statement for the given expression (e.g. np.zeros)

Recommended keymappings:

nmap <silent> <M-CR>   :ImportSymbol<CR>
imap <silent> <M-CR>   <Esc>:ImportSymbol<CR>a

Tip: How to sort imports?

command! -buffer ImportOrganize    :CocCommand python.sortImports

License

The MIT License (c) 2020 Jongwook Choi (@wookayin)