Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Remove space added by completion
- X-seq: zsh-users 18498
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Remove space added by completion
- Date: Thu, 20 Feb 2014 11:05:59 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1392890761; bh=I3g8/KIZGxu4si4Dl+U9/A7RjDX5CjsXnhW2xNkxI/g=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Received:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=Hr8SIwucbbkgIww3yhtYKpo95iFWBS1PXptAbpUhBeMCDLNYjCFytZwoi9R7wHMmn9Quy9YrjApDaSB15ZHka8acRQSvnwd4lWzeLETpBzP+AWJyREzKI07AkJYcob5gpUA36EWaukqedSgreliLnjTXq1MH9EA4E3rjTSu2xnE=
- In-reply-to: <XnsA2D581C242E30davidrayninfocouk@80.91.229.13>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <XnsA2D4DCC6C1E4Bdavidrayninfocouk@80.91.229.13> <16835.1392415885@thecus.kiddle.eu> <XnsA2D581C242E30davidrayninfocouk@80.91.229.13>
On 15 Feb, zzapper wrote:
> > It might be useful to have a specific example of an unwanted space.
> alias -g NF='*~vssver.scc(.om[1])'
> ls NF<TAB>
_expand looks at an add-space style to see whether to add a space suffix
so it seems logical for _expand_alias to also observe that style. At
least only for a true/false value (_expand has special handling for
files/directories).
Note that _expand_alias is using expand-alias-word in the zstyle
context which is perhaps not what you'd first guess.
Oliver
diff --git a/Completion/Base/Completer/_expand_alias b/Completion/Base/Completer/_expand_alias
index 8848e66..8240e41 100644
--- a/Completion/Base/Completer/_expand_alias
+++ b/Completion/Base/Completer/_expand_alias
@@ -1,7 +1,7 @@
#compdef -K _expand_alias complete-word \C-xa
local word expl tmp pre sel what
-local -a tmpa
+local -a tmpa suf
eval "$_comp_setup"
@@ -58,7 +58,8 @@ if [[ -n $tmp ]]; then
tmp="\\$tmp"
fi
fi
- $pre _wanted aliases expl alias compadd -UQ -- ${tmp%%[[:blank:]]##}
+ zstyle -T ":completion:${curcontext}:" add-space || suf=( -S '' )
+ $pre _wanted aliases expl alias compadd -UQ "$suf[@]" -- ${tmp%%[[:blank:]]##}
elif (( $#pre )) && zstyle -t ":completion:${curcontext}:" complete; then
$pre _aliases -s "$sel" -S ''
else
Messages sorted by:
Reverse Date,
Date,
Thread,
Author