From: Jakub Jirutka Date: Wed, 11 Jan 2023 01:22:39 +0100 Subject: [PATCH] Store db in $ZSH_DATA_DIR or $XDG_DATA_HOME if set --- a/sqlite-history.zsh +++ b/sqlite-history.zsh @@ -9,7 +9,11 @@ typeset -g HISTDB_QUERY="" if [[ -z ${HISTDB_FILE} ]]; then - typeset -g HISTDB_FILE="${HOME}/.histdb/zsh-history.db" + if [[ -z "${ZSH_DATA_DIR}${XDG_DATA_HOME}" ]]; then + typeset -g HISTDB_FILE="$HOME/.histdb/zsh-history.db" + else + typeset -g HISTDB_FILE="${ZSH_DATA_DIR:-$XDG_DATA_HOME/zsh}/histdb.sqlite" + fi else typeset -g HISTDB_FILE fi