Linux vim编辑器中tab自动补全python命令脚本

一、脚本文件:
#!/usr/bin/python
# python startup file

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

二、用法:
[root@localhost tmp]# python
>>> import user_startup
>>> import sys
>>> sys.
sys.__class__              sys.exec_prefix
sys.__delattr__            sys.executable
sys.__dict__               sys.exit
sys.__displayhook__        sys.exitfunc
sys.__doc__                sys.getcheckinterval
sys.__excepthook__         sys.getdefaultencodi

你可能感兴趣的:(linux,python,vim,tab)