1. 新建python自动补全脚步
$ cd <workdir>
$ touch tab.py
$ vim tab.py,输入如下内容后保存
$ chmod +x tab.py
#!/usr/bin/env python import sys
import readline
import rlcompleter if sys.platform == 'darwin':
readline.parse_and_bind("bind '\t' rl_complete")
else:
readline.parse_and_bind("tab: complete")
2. 修改bash profile
$ echo "export PYTHONSTARTUP=<worddir>/tab.py" >> ~/.bash_profile
$ source ~/.bash_profile