很久不写blog了。
最近发现python的自动补全是个好东西。
分享一下。
参考了:http://www.cnblogs.com/allenblogs/archive/2011/04/21/2023288.html 和 软件手册
下载地址:http://vim.sourceforge.net/scripts/script.php?script_id=850
直接粘贴了。
------------------------------
vim编辑器中
#mkdir -p ~/.vim/after/ftplugin/
#mkdir -p ~/.vim/bundle/pydiction/
#unzip pydiction-1.2.3.zip
#cd pydiction
#cp after/ftplugin/python_pydiction.vim ~/.vim/after/ftplugin/
#cp complete-dict ~/.vim/bundle/pydiction/
#cp pydiction.py ~/.vim/bundle/pydiction/
#vim ~/.vimrc
filetype plugin on
let g:pydiction_location = ‘~/.vim/bundle/pydiction/complete-dict‘
let g:pydiction_menu_height = 3
python交互模式下
#cat python-tab-completion.sh
#!/bin/bash
cat >> ~/.python-tab-completion.py <<EOF
#!/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
EOF
echo ‘export PYTHONSTARTUP=~/.python-tab-completion.py‘ >> ~/.bashrc
#bash python-tab-completion.sh
本文出自 “shark巨菜-菜园志” 博客,请务必保留此出处http://sharkyan.blog.51cto.com/536264/1529796