zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-users@zsh.org
Subject: Re: Remove space added by completion
Date: Thu, 20 Feb 2014 11:05:59 +0100	[thread overview]
Message-ID: <27810.1392890759@thecus.kiddle.eu> (raw)
In-Reply-To: <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


      reply	other threads:[~2014-02-20 10:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 21:42 zzapper
2014-02-14 22:11 ` Oliver Kiddle
2014-02-15  0:49   ` Aaron Schrab
2014-02-15  2:33     ` Bart Schaefer
2014-02-15  4:45       ` Aaron Schrab
2014-02-18 16:54         ` Oliver Kiddle
2014-02-20  1:33           ` Aaron Schrab
2014-03-22 14:10           ` m0viefreak
2014-03-22 16:43             ` [PATCH] _git: auto-removable '..' suffix: remove at the end of lines m0viefreak
2014-03-22 17:37               ` Bart Schaefer
2014-03-23  3:41                 ` m0viefreak
2014-03-23  6:45                   ` Bart Schaefer
2014-03-23 18:38                     ` [PATCH] zle/completion: fix auto-removable suffix highlighting m0viefreak
2014-02-15 12:45   ` Remove space added by completion zzapper
2014-02-20 10:05     ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27810.1392890759@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).