Python tab補全

Linux系統中的Python tab補全腳本:python

 1 #!/usr/bin/env python 
 2 # python startup file 
 3 import sys
 4 import readline
 5 import rlcompleter
 6 import atexit
 7 import os
 8 # tab completion 
 9 readline.parse_and_bind('tab: complete')
10 # history file 
11 histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
12 try:
13     readline.read_history_file(histfile)
14 except IOError:
15     pass
16 atexit.register(readline.write_history_file, histfile)
17 del os, histfile, readline, rlcompleter

寫完以後將tab.py文件放到全局環境變量目錄/usr/local/python35/lib/python3.5/site-packages/中就能夠了spa

 

此腳本Python2通用,按照一樣的方法配置。code

相關文章
相關標籤/搜索