做者:gnuhpc
出處:http://www.cnblogs.com/gnuhpc/python
1. VIM下的配置:git
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 github
rm -f pydiction shell
確保文件結構以下:vim
# tree ~/.vim /root/.vim ├── after │ └── ftplugin │ └── python_pydiction.vim └── tools └── pydiction └── complete-dict
而後編輯~/.vimrc
# cat ~/.vimrc filetype plugin on let g:pydiction_location = '~/.vim/tools/pydiction/complete-dict'
2. Python Console命令行:
# ~/.bashrc export PYTHONSTARTUP=$HOME/.pythonstartup.py
(此變量指向的文件在python命令行啓動時會自動加載)
#vim ~/.pythonstartup.py bash
try: import readline import rlcompleter import atexit import os except ImportError: print "Python shell enhancement modules not available." else: histfile = os.path.join(os.environ["HOME"], ".pythonhistory") import rlcompleter readline.parse_and_bind("tab: complete") if os.path.isfile(histfile): readline.read_history_file(histfile) atexit.register(readline.write_history_file, histfile) del os, histfile, readline, rlcompleter, atexit print "Python shell history and tab completion are enabled."
更簡單的方式是安裝IPythonspa
做者:gnuhpc
出處:http://www.cnblogs.com/gnuhpc/命令行