diff options
author | 2025-01-22 18:39:11 +0100 | |
---|---|---|
committer | 2025-01-22 18:40:10 +0100 | |
commit | 1c202b4bb8bc8e1e9a951c3b85101c5c59821896 (patch) | |
tree | 764f260f0018b9cbe28f2d57a2d2f41f8315b94c | |
parent | 04155f5d1afb2313c57daf98109e20bb6f3e22c9 (diff) | |
download | zuwu-1c202b4bb8bc8e1e9a951c3b85101c5c59821896.tar.gz zuwu-1c202b4bb8bc8e1e9a951c3b85101c5c59821896.tar.bz2 zuwu-1c202b4bb8bc8e1e9a951c3b85101c5c59821896.tar.lz zuwu-1c202b4bb8bc8e1e9a951c3b85101c5c59821896.zip |
fix: use XDG_{CONFIG,DATA}_HOME
-rwxr-xr-x | install.zsh | 4 | ||||
-rwxr-xr-x | zuwu.zsh | 15 |
2 files changed, 10 insertions, 9 deletions
diff --git a/install.zsh b/install.zsh index c493ebd..b7dfec7 100755 --- a/install.zsh +++ b/install.zsh @@ -36,7 +36,7 @@ elif [[ "$PREFIX" != "" ]]; then elif [[ "$(whoami)" == "root" ]]; then TARGET="/usr/local/share/zsh/plugins/zuwu" else - TARGET="$HOME/.local/share/zsh/plugins/zuwu" + TARGET="${XDG_DATA_HOME:-"$HOME/.local/share"}/zsh/plugins/zuwu" fi mkdir -p "$TARGET" @@ -64,7 +64,7 @@ fi # - distribution packaging target # - local system-wide installation target # - local per-user installation target -for d in /usr/share/zsh/plugins/zuwu /usr/local/share/zsh/plugins/zuwu "\\\$HOME/.local/share/zsh/plugins/zuwu"; do +for d in /usr/share/zsh/plugins/zuwu /usr/local/share/zsh/plugins/zuwu "\\\${XDG_DATA_HOME:-"\\\$HOME/.local/share"}/zsh/plugins/zuwu"; do if [[ -d "\\\$d" ]]; then source "\\\$d/zuwu.zsh" # For debugging, calling _ZUWU_DETECTED_INSTALL_PATH=/dev/null zsh -c 'source ~/.zshrc && echo "\\\$_ZUWU_DETECTED_INSTALL_PATH"' may be useful @@ -63,7 +63,7 @@ if ! [[ -f "$HOME/.zshenv" ]]; then # # Remove the following line if you do not want zuwu's environment. -for d in /usr/share/zsh/plugins/zuwu /usr/local/share/zsh/plugins/zuwu "\$HOME/.local/share/zsh/plugins/zuwu"; do +for d in /usr/share/zsh/plugins/zuwu /usr/local/share/zsh/plugins/zuwu "\${XDG_DATA_HOME:-"\$HOME/.local/share"}/zsh/plugins/zuwu"; do if [[ -f "\$d/env.zsh" ]]; then source "\$d/env.zsh" break @@ -95,13 +95,14 @@ autoload -U down-line-or-beginning-search # Keybinds and all that jazz reloadopt() { if [[ -f "$HOME/.zshconf" ]]; then - if ! [[ -d "$HOME/.config" ]]; then - mkdir "$HOME/.config" + no-op "${XDG_CONFIG_HOME:="$HOME/.config"}"; + if ! [[ -d "$XDG_CONFIG_HOME" ]]; then + mkdir "$XDG_CONFIG_HOME" fi - mv "$HOME/.zshconf" "$HOME/.config/zuwu.conf" + mv "$HOME/.zshconf" "$XDG_CONFIG_HOME}/zuwu.conf" fi - if [[ -f "$HOME/.config/zuwu.conf" ]]; then - source "$HOME/.config/zuwu.conf" + if [[ -f "$XDG_CONFIG_HOME.conf" ]]; then + source "$XDG_CONFIG_HOME.conf" fi __bindkey() { @@ -205,7 +206,7 @@ while IFS= read -r f; do done <<< "$(_each_share_dir zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh)" # Cute Prompting -if [[ "$_ZUWU_NO_STARSHIP-$_ZUWU_NO_PROMPT" == "-" ]] && [[ -f ~/.config/starship.toml ]] && type "starship" >/dev/null; then +if [[ "$_ZUWU_NO_STARSHIP-$_ZUWU_NO_PROMPT" == "-" ]] && [[ -f "${XDG_CONFIG_HOME:-"$HOME/.config"}/starship.toml" ]] && type "starship" >/dev/null; then eval "$(starship init zsh)" elif [[ "$_ZUWU_HYPERFAST-$_ZUWU_NO_PROMPT" == "-" ]]; then # unsure of source of function |