python环境下使用tab自动补全命令
2016-06-15 17:49
771 查看
# vim /usr/lib/python2.7/dist-packages/tab.py
加入如下内容:
#!/usr/bin/env 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
测试:
# python
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import tab
>>> sys.
sys.__class__( sys.argv sys.hexversion
sys.__delattr__( sys.builtin_module_names sys.long_info
sys.__dict__ sys.byteorder sys.maxint
sys.__displayhook__( sys.call_tracing( sys.maxsize
sys.__doc__ sys.callstats( sys.maxunicode
sys.__excepthook__( sys.copyright sys.meta_path
sys.__format__( sys.displayhook( sys.modules
sys.__getattribute__( sys.dont_write_bytecode sys.path
sys.__hash__( sys.exc_clear( sys.path_hooks
sys.__init__( sys.exc_info( sys.path_importer_cache
sys.__name__ sys.exc_type sys.platform
sys.__new__( sys.excepthook( sys.prefix
sys.__package__ sys.exec_prefix sys.ps1
sys.__reduce__( sys.executable sys.ps2
sys.__reduce_ex__( sys.exit( sys.py3kwarning
sys.__repr__( sys.exitfunc( sys.pydebug
sys.__setattr__( sys.flags sys.setcheckinterval(
sys.__sizeof__( sys.float_info sys.setdlopenflags(
sys.__stderr__ sys.float_repr_style sys.setprofile(
sys.__stdin__ sys.getcheckinterval( sys.setrecursionlimit(
sys.__stdout__ sys.getdefaultencoding( sys.settrace(
sys.__str__( sys.getdlopenflags( sys.stderr
sys.__subclasshook__( sys.getfilesystemencoding( sys.stdin
sys._clear_type_cache( sys.getprofile( sys.stdout
sys._current_frames( sys.getrecursionlimit( sys.subversion
sys._getframe( sys.getrefcount( sys.version
sys._mercurial sys.getsizeof( sys.version_info
sys.api_version sys.gettrace( sys.warnoptions
加入如下内容:
#!/usr/bin/env 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
测试:
# python
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import tab
>>> sys.
sys.__class__( sys.argv sys.hexversion
sys.__delattr__( sys.builtin_module_names sys.long_info
sys.__dict__ sys.byteorder sys.maxint
sys.__displayhook__( sys.call_tracing( sys.maxsize
sys.__doc__ sys.callstats( sys.maxunicode
sys.__excepthook__( sys.copyright sys.meta_path
sys.__format__( sys.displayhook( sys.modules
sys.__getattribute__( sys.dont_write_bytecode sys.path
sys.__hash__( sys.exc_clear( sys.path_hooks
sys.__init__( sys.exc_info( sys.path_importer_cache
sys.__name__ sys.exc_type sys.platform
sys.__new__( sys.excepthook( sys.prefix
sys.__package__ sys.exec_prefix sys.ps1
sys.__reduce__( sys.executable sys.ps2
sys.__reduce_ex__( sys.exit( sys.py3kwarning
sys.__repr__( sys.exitfunc( sys.pydebug
sys.__setattr__( sys.flags sys.setcheckinterval(
sys.__sizeof__( sys.float_info sys.setdlopenflags(
sys.__stderr__ sys.float_repr_style sys.setprofile(
sys.__stdin__ sys.getcheckinterval( sys.setrecursionlimit(
sys.__stdout__ sys.getdefaultencoding( sys.settrace(
sys.__str__( sys.getdlopenflags( sys.stderr
sys.__subclasshook__( sys.getfilesystemencoding( sys.stdin
sys._clear_type_cache( sys.getprofile( sys.stdout
sys._current_frames( sys.getrecursionlimit( sys.subversion
sys._getframe( sys.getrefcount( sys.version
sys._mercurial sys.getsizeof( sys.version_info
sys.api_version sys.gettrace( sys.warnoptions
相关文章推荐
- python环境下使用tab自动补全命令
- 从零开始:用Python实现KNN算法
- python 内联函数
- python自动生成执行集群操作脚本
- python包的各种安装问题汇总
- 最近在学python web初体验
- Python学习笔记 —— 类
- [ 每日一课】 Python官方文档 1 -- 简介
- python释放内存(2)
- Python 获得命令行参数的方法
- python 释放内存(1)
- Python连接Hive
- Python基本运算符
- python学习笔记 操作文件和目录
- Python学习笔记 20160615
- Python自然语言处理第二章部分习题
- python lib error
- Python编码问题
- python学习笔记 IO 文件读写
- python中获取div的文本内容并和想定结果进行对比