One, vim python automatic complement full plugin: pydiction
You can implement automatic completion of the following Python code:
1. Simple python keyword completion
2.python function Complement full bracket
3.python Module Completion
4.python module inner function, variable complement
5.from Module Import sub-module complement
For VIM to start automatic complement need to download the plugin, the address is as follows:
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
Make sure the file structure is as follows:
# Tree ~/.vim
/root/.vim
├──after
│└──ftplugin
│└──python_pydiction.vim
└──tools
└──pydiction
└──complete-dict
Create ~/.VIMRC to ensure that the contents are as follows:
# cat ~/.VIMRC
filetype plugin on let
g:pydiction_location = ' ~/.vim/tools/pydiction/complete-dict '
Use Vim to edit a py file, import os., this time should appear prompt, prove successful, the following figure
Second, the Python Interactive mode tab automatically padded
The file is created 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 The shell, enter the python command into interactive mode, you can use the TAB key to complement. The following figure: