aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2023-05-26 13:17:42 +0200
committerDavid Runge <dave@sleepmap.de>2023-05-26 13:17:42 +0200
commit29557d41076a9bfd2372e7017c46cfb8a1a030e8 (patch)
tree8a85a13f190c88c3e5f3868c1c8173075f1d1000
parent4e9c490f8ac62826afa45f96a43fa18a5a6c37f9 (diff)
downloaddotfiles-29557d41076a9bfd2372e7017c46cfb8a1a030e8.tar.gz
dotfiles-29557d41076a9bfd2372e7017c46cfb8a1a030e8.tar.bz2
dotfiles-29557d41076a9bfd2372e7017c46cfb8a1a030e8.tar.xz
dotfiles-29557d41076a9bfd2372e7017c46cfb8a1a030e8.zip
zsh: ensure that the parent dir of HISTFILE exists
-rw-r--r--.config/zsh/.zshrc3
1 files changed, 2 insertions, 1 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index 3d3542a..b9fcc75 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -185,7 +185,8 @@ unset key{,map,bindings}
# History
#
# The path to the history file
-HISTFILE="$HOME/.local/state/zsh/history"
+[[ ! -d "${XDG_STATE_HOME:-$HOME/.local/state}/zsh/" ]] && mkdir -p "${XDG_STATE_HOME:-$HOME/.local/state}/zsh/"
+HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/zsh/history"
# The maximum number of events to save in the internal history.
HISTSIZE=10000
# The maximum number of events to save in the history file.