diff options
author | Timo Wilken | 2024-09-10 21:34:09 +0200 |
---|---|---|
committer | Timo Wilken | 2024-09-10 21:34:09 +0200 |
commit | 3cde692c17940d2eecbe27eef7038b6edaac8502 (patch) | |
tree | 05a4e277031e7347258be14adfee14c74ca90e3a | |
parent | 41feaa23d3662eea0960f6ebad8dfae00564a5bb (diff) |
Fix git completion in zsh
-rw-r--r-- | tw/home/files/zshrc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tw/home/files/zshrc b/tw/home/files/zshrc index 52f930cc..737a4f2d 100644 --- a/tw/home/files/zshrc +++ b/tw/home/files/zshrc @@ -75,6 +75,13 @@ zstyle ':completion:*' max-errors 3 zstyle ':completion:*' original true zstyle ':completion:*' verbose true +# Tell git where to find its bash completion script. +for _profile in /usr ${GUIX_ENVIRONMENT+"$GUIX_ENVIRONMENT"} ~/.guix-profile ~/.guix-home/profile /run/current-system/profile; do + [ -e "$_profile/etc/bash_completion.d/git" ] || continue + zstyle ':completion:*:*:git:*' script "$_profile/etc/bash_completion.d/git" + break +done; unset _profile + autoload -Uz compinit if mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/zsh"; then compinit -d "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump-$ZSH_VERSION" @@ -150,9 +157,11 @@ fi ## Plugins load_plugin () { - local try_path - for try_path in {/usr,"$GUIX_ENVIRONMENT","$HOME/.guix-profile","$HOME/.guix-home/profile"}"/share/zsh/plugins/$1/$1"{.plugin,}.zsh; do - [ -r "$try_path" ] && . "$try_path" && return 0 + local profile try_path + for profile in /usr ${GUIX_ENVIRONMENT+"$GUIX_ENVIRONMENT"} ~/.guix-profile ~/.guix-home/profile /run/current-system/profile; do + for try_path in "$profile/share/zsh/plugins/$1/$1"{.plugin,}.zsh; do + [ -r "$try_path" ] && . "$try_path" && return 0 + done done return 1 } |