diff options
| author | Marc Finet <m.dreadlock@gmail.com> | 2014-09-12 23:30:36 +0200 |
|---|---|---|
| committer | Frank Terbeck <ft@bewatermyfriend.org> | 2014-09-14 12:02:35 +0200 |
| commit | ffd439b69b49c2762eaee888d622d7e843103c62 (patch) | |
| tree | a2f1fda863f68d93a9b0ce83c0eb7c0a8824faa2 /Completion/Unix/Command | |
| parent | 33149: vcs_info examples: fix typo (diff) | |
| download | zsh-ffd439b69b49c2762eaee888d622d7e843103c62.tar zsh-ffd439b69b49c2762eaee888d622d7e843103c62.tar.gz zsh-ffd439b69b49c2762eaee888d622d7e843103c62.tar.bz2 zsh-ffd439b69b49c2762eaee888d622d7e843103c62.tar.lz zsh-ffd439b69b49c2762eaee888d622d7e843103c62.tar.xz zsh-ffd439b69b49c2762eaee888d622d7e843103c62.tar.zst zsh-ffd439b69b49c2762eaee888d622d7e843103c62.zip | |
33151: completion git: support aliases when \n exist
The git completion for aliases (i.e. completing with aliased verb)
was broken whem some \n exist in aliases.
Diffstat (limited to 'Completion/Unix/Command')
| -rw-r--r-- | Completion/Unix/Command/_git | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b1f411a5e..d941aac0f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6560,9 +6560,13 @@ _git() { if (( CURRENT > 2 )); then local -a aliases local -A git_aliases - # TODO: Should use -z here, but I couldn't get it to work. - aliases=(${(f)${${${(f)"$(_call_program aliases git config --get-regexp '\^alias\.')"}#alias.}/ /$'\n'}/(#e)/$'\n'}) - (( $#aliases % 2 == 0 )) && git_aliases=($aliases) + local k v + aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\.')"}) + for a in ${aliases}; do + k="${${a/$'\n'*}/alias.}" + v="${a#*$'\n'}" + git_aliases[$k]="$v" + done if (( $+git_aliases[$words[2]] && !$+commands[git-$words[2]] && !$+functions[_git-$words[2]] )); then local -a tmpwords expalias |
