Use the .history directory for readline history
This commit is contained in:
parent
0d9a54719a
commit
6d4ee75eb1
11
pythonrc
11
pythonrc
@ -1,8 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
#{- ~/.pythonrc -}#
|
||||
|
||||
import atexit
|
||||
import os
|
||||
import readline
|
||||
import sys
|
||||
|
||||
# Primary prompt: (>>> ) in magenta
|
||||
sys.ps1 = '\033[1;35m>>>\033[0m '
|
||||
# Secondary prompt: (... ) in red
|
||||
sys.ps2 = '\033[1;31m...\033[0m '
|
||||
|
||||
# Use ~/.history/python as a history file instead of ~/.python_history
|
||||
history_file = os.path.join (os.environ['HOME'], '.history', 'python')
|
||||
if os.path.exists(history_file):
|
||||
readline.read_history_file(history_file)
|
||||
atexit.register(readline.write_history_file, history_file)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user