One, vim python automatic completion plug-in: pydiction
You can implement the following Python code auto-completion:
1. Simple python keyword completion
2.python function Completion with parentheses
3.python Module Completion
4.python module internal function, variable completion
5.from Module Import sub-module complement
To start AutoComplete for vim, you need to download the plugin at the following address:
http://vim.sourceforge.net/scripts/script.php?script_id=850
Https://github.com/rkulla/pydiction
Installation configuration:
wget https:
//github
.com
/rkulla/pydiction/archive/master
.zip
unzip -q master
mv
pydiction-master pydiction
mkdir
-p ~/.vim
/tools/pydiction
cp
-r pydiction
/after
~/.vim
cp
pydiction
/complete-dict
~/.vim
/tools/pydiction
Ensure that the file structure is as follows:
# Tree ~/.vim
/root/.vim
├──after
│└──ftplugin
│└──python_pydiction.vim
└──tools
└──pydiction
└──complete-dict
Create a ~/.VIMRC to make sure the contents are as follows:
# cat ~/.vimrc
filetype plugin on
let
g:pydiction_location =
‘~/.vim/tools/pydiction/complete-dict‘
Using Vim to edit a py file, import OS, this time should appear prompt, (if not prompted to press the TAB key) to prove success, such as
Second, the Python Interactive mode tab auto-completion
Create the file as follows:
# cat ~/.pythonstartup
# python startup file
#!/usr/bin/env python
import
sys
import
readline
import
rlcompleter
import
atexit
import
os
# tab completion
readline.parse_and_bind(
‘tab: complete‘
)
# history file
histfile = os.path.
join
(os.environ[
‘HOME‘
],
‘.pythonhistory‘
)
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter
1
echo
‘export PYTHONSTARTUP=~/.pythonstartup‘
>> ~/.bash_profile
Re-login to the shell, enter the python command into interactive mode, you can use the TAB key to complete the completion. Such as:
Python Auto-complete (VIM)