summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2020-05-24 13:57:05 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2020-05-24 13:57:05 +0100
commit11ec2cb4c4ca290c71517867ad9369562078b094 (patch)
tree512e55243348e899a76419fdfaee3e88d774e455
parent9121a7ced53b011299d1540a06aa5ce01a3244ce (diff)
Add python configuration
-rw-r--r--python/rc12
-rw-r--r--zsh/rc1
2 files changed, 13 insertions, 0 deletions
diff --git a/python/rc b/python/rc
new file mode 100644
index 0000000..cb560be
--- /dev/null
+++ b/python/rc
@@ -0,0 +1,12 @@
+# -*- mode: python -*-
+
+import atexit
+import os
+import readline
+
+history_file = os.path.join(os.getenv('XDG_CACHE_HOME'), 'python_history')
+if os.path.exists(history_file):
+ readline.read_history_file(history_file)
+readline.set_history_length(1000)
+atexit.register(readline.write_history_file, history_file)
+del atexit, history_file, os, readline
diff --git a/zsh/rc b/zsh/rc
index 7b46e61..04fc7fe 100644
--- a/zsh/rc
+++ b/zsh/rc
@@ -43,6 +43,7 @@ bindkey -e
bindkey "^R" history-incremental-search-backward
export EDITOR=vim
+export PYTHONSTARTUP=${XDG_CONFIG_HOME}/python/rc
export VISUAL=${EDITOR}
setopt AUTO_CD