Mercurial > public > dotfiles
annotate python/.pythonstartup @ 19:020acc7e87c9
No longer bundle ctrl-p.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 18 Dec 2014 18:24:41 -0600 |
parents | 357906c82c1f |
children |
rev | line source |
---|---|
bgneal@14 | 1 # python startup file |
bgneal@14 | 2 try: |
bgneal@14 | 3 import readline |
bgneal@14 | 4 except ImportError: |
bgneal@14 | 5 pass |
bgneal@14 | 6 else: |
bgneal@14 | 7 import atexit |
bgneal@14 | 8 import os |
bgneal@14 | 9 import rlcompleter |
bgneal@14 | 10 |
bgneal@14 | 11 # tab completion |
bgneal@14 | 12 readline.parse_and_bind('tab: complete') |
bgneal@14 | 13 |
bgneal@14 | 14 # history file |
bgneal@14 | 15 histfile = os.path.join(os.environ['HOME'], '.pythonhistory') |
bgneal@14 | 16 try: |
bgneal@14 | 17 readline.read_history_file(histfile) |
bgneal@14 | 18 except IOError: |
bgneal@14 | 19 pass |
bgneal@14 | 20 readline.set_history_length(1024) |
bgneal@14 | 21 |
bgneal@14 | 22 atexit.register(readline.write_history_file, histfile) |
bgneal@14 | 23 del os, histfile, readline, rlcompleter |