From 1c202b4bb8bc8e1e9a951c3b85101c5c59821896 Mon Sep 17 00:00:00 2001 From: memdmp Date: Wed, 22 Jan 2025 18:39:11 +0100 Subject: fix: use XDG_{CONFIG,DATA}_HOME --- zuwu.zsh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'zuwu.zsh') diff --git a/zuwu.zsh b/zuwu.zsh index d74b1eb..b5d3c02 100755 --- a/zuwu.zsh +++ b/zuwu.zsh @@ -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 -- cgit v1.2.3