]> arthur.barton.de Git - ax-zsh.git/commitdiff
history: Save history file in cache directory by default
authorAlexander Barton <alex@barton.de>
Sun, 19 Jul 2015 15:02:18 +0000 (17:02 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 19 Jul 2015 15:02:18 +0000 (17:02 +0200)
plugins/history/history.zshrc

index 6470c43baf865ca1d467d7fc9f4e0164df09d4cc..a70d304269ab03a4c75253a8ff244677490831a0 100644 (file)
@@ -1,7 +1,13 @@
 # AX-ZSH: Alex' Modular ZSH Configuration
 # history.zshrc: Setup ZSH history
 
-[[ -z "$HISTFILE" ]] && HISTFILE="$HOME/.zsh_history"
+if [[ -z "$HISTFILE" ]]; then
+       # Save history file in cache directory, if not already present
+       # in $ZDOTDIR/$HOME:
+       [ -r "${ZDOTDIR:-$HOME}/.zsh_history" ] \
+               && HISTFILE="${ZDOTDIR:-$HOME}/.zsh_history" \
+               || HISTFILE="$ZSH_CACHE_DIR/history"
+fi
 
 HISTSIZE=10000
 SAVEHIST=10000