mac版python TAB补全功能
来源:互联网 发布:mac python idle 编辑:程序博客网 时间:2024/05/20 17:41
root# cat tab.py
import readline,rlcompleter
### Indenting
class TabCompleter(rlcompleter.Completer):
"""Completer that supports indenting"""
def complete(self, text, state):
if not text:
return (' ', None)[state]
else:
return rlcompleter.Completer.complete(self, text, state)
readline.set_completer(TabCompleter().complete)
### Add autocompletion
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind -e")
readline.parse_and_bind("bind '\t' rl_complete")
else:
readline.parse_and_bind("tab: complete")
### Add history
import os
histfile = os.path.join(os.environ["HOME"], ".pyhist")
try:
readline.read_history_file(histfile)
except IOError:
pass
import atexit
atexit.register(readline.write_history_file, histfile)
del histfile
import readline,rlcompleter
### Indenting
class TabCompleter(rlcompleter.Completer):
"""Completer that supports indenting"""
def complete(self, text, state):
if not text:
return (' ', None)[state]
else:
return rlcompleter.Completer.complete(self, text, state)
readline.set_completer(TabCompleter().complete)
### Add autocompletion
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind -e")
readline.parse_and_bind("bind '\t' rl_complete")
else:
readline.parse_and_bind("tab: complete")
### Add history
import os
histfile = os.path.join(os.environ["HOME"], ".pyhist")
try:
readline.read_history_file(histfile)
except IOError:
pass
import atexit
atexit.register(readline.write_history_file, histfile)
del histfile
0 0
- mac版python TAB补全功能
- python tab键补全功能
- python添加tab补全功能
- Mac OS X Terminal 打开Tab键自动补全功能
- 为python命令行添加Tab键自动补全功能
- Python中tab键自动补全功能的配置
- bash下tab补全功能
- Python高级编程笔记(一)-- Linux下python命令行tab键自动补全功能设置
- linux环境下tab 自动补全功能
- Windows cmd tab键自动补全功能
- CentOS下为python命令行添加Tab键自动补全功能
- CentOS下为python命令行添加Tab键自动补全功能
- 在Linux系统系自带的python shell 模式下支持tab键补全功能
- vim python自动补全功能
- MAC下开启Terminal自动补全功能
- python tab 补全
- python tab补全
- python tab补全
- 关于多张图片的上传处理方法
- java中Atomic类之AtomicBoolean
- C#通过TCP传送结构体
- 在录音等情况下保持屏幕长亮
- 多图详解Spring框架的设计理念与设计模式
- mac版python TAB补全功能
- 单例在Swift中的正确实现方式
- [Git]第二讲:Git安装
- 让UILabel提示文字动起来
- Android天气Demo
- Linux使用Shell脚本实现ftp的自动上传下载
- 方便的int转float或者float转int(不舍弃二进制格式)
- 各浏览器css按钮的样式不统一!
- Android WebView编程的那些坑(一)