diff --git a/pythonrc b/pythonrc index 7a54a82..2f88b26 100644 --- a/pythonrc +++ b/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)