-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.pythonrc
More file actions
51 lines (41 loc) · 1.15 KB
/
.pythonrc
File metadata and controls
51 lines (41 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from __future__ import print_function
import os
import sys
try:
import readline
except ImportError:
print("Module readline not available.")
else:
histfile = os.path.expanduser('~/.python_history')
try:
readline.read_history_file(histfile)
except IOError:
pass
import atexit
def write_history(readline=readline, histfile=histfile):
try:
readline.write_history_file(histfile)
except IOError:
pass
atexit.register(write_history)
del histfile, atexit, write_history
import rlcompleter
readline.parse_and_bind("tab: complete")
del rlcompleter
del readline
if os.getenv('TERM') in ('xterm', 'xterm-256color',
'screen', 'screen-256color',
'rxvt', 'vt100', 'Eterm', 'putty',
'rxvt-unicode', 'rxvt-unicode-256color',
'linux'):
sys.ps1 = '\001\033[01;31m\002>>> \001\033[0m\002'
# No more ... when copying/pasting
sys.ps2 = ''
# reload() for Python 3
try:
reload
except NameError:
from importlib import reload # noqa
del sys
del os
# vim: set ft=python: