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.zipunzip-q mastermv pydiction-master pydictionmkdir-p ~/. Vim/tools/pydictioncp-r pydiction/after ~/.VIMCP 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 ~/.vimrcfiletype plugin Onlet g:pydiction_location = ' ~/.vim/tools/pydiction/complete-dict '
Use Vim to edit a py file, import os., this time should appear prompt, 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 pythonimport sysimport readlineimport rlcompleterimport Atexitimport os# tab completionreadline.parse_and_bind (' Tab:complete ') # History filehistfile = Os.path.join ( os.environ[' HOME '], '. Pythonhistory ') Try: readline.read_history_file (histfile) except IOError: Passatexit.register (Readline.write_history_file, histfile) del os, Histfile, ReadLine, Rlcompleter1echo ' 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: