From 8010661af8e602d5148812d7c8522c9af486f0ca Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Wed, 31 Jul 2024 11:43:10 +0200 Subject: [PATCH] fix(zsh): move cache directory --- zsh/rc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/zsh/rc b/zsh/rc index 1e899df..acaae6a 100644 --- a/zsh/rc +++ b/zsh/rc @@ -1,6 +1,11 @@ # vim: set ft=zsh: _here="$(dirname -- "$(readlink -f -- "${HOME}/.zshrc")")" +_cache_dir="${XDG_CACHE_HOME:-"${HOME}/.cache"}/zsh" + +if [[ ! -d "${_cache_dir}" ]]; then + mkdir -p "${_cache_dir}" +fi ########### # Options # @@ -60,22 +65,14 @@ source "${_here}/prompt" # Plugins # ########### -if [[ ! -d "${_here}/.cache" ]]; then - mkdir "${_here}/.cache" -fi - -_antidote="${_here}/.cache/.antidote" +_antidote="${_cache_dir}/antidote" _plugins="${_here}/plugins" -_plugins_cache="${_here}/.cache/plugins.zsh" +_plugins_cache="${_cache_dir}/plugins" if [[ ! -d "$_antidote" ]]; then git clone --depth=1 https://github.com/mattmc3/antidote.git "$_antidote" fi -if [[ ! -f "${_plugins}" ]]; then - touch "${_plugins}" -fi - fpath=("${_antidote}/functions" "${fpath[@]}") autoload -Uz antidote @@ -83,7 +80,7 @@ if [[ ! "${_plugins_cache}" -nt "${_plugins}" ]]; then antidote bundle <"${_plugins}" >"${_plugins_cache}" fi -# shellcheck source=zsh/.cache/plugins.zsh +# shellcheck disable=SC1090 source "${_plugins_cache}" unset _antidote _plugins _plugins_cache @@ -154,4 +151,4 @@ alias ssh='ssh_with_title' # Cleanup # ########### -unset _here +unset _here _cache_dir