-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonstartup
More file actions
33 lines (27 loc) · 765 Bytes
/
pythonstartup
File metadata and controls
33 lines (27 loc) · 765 Bytes
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
import atexit
import os
import sys
# - command line VIM?
try:
import readline
readline.parse_and_bind('tab: complete')
readline.parse_and_bind('set editing-mode vi')
print "-- readline available."
except ImportError:
print "-- readline not available."
else:
import rlcompleter
if 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
else:
readline.parse_and_bind("tab: complete")
print "-- rlcomplete available"
if sys.version[0] == 2:
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 histfile
del os, sys, readline, rlcompleter