From: Oliver Kiddle <opk@u.genie.co.uk>
To: zsh-workers@sunsite.auc.dk
Subject: Re: help with _match, globcomplete etc. (with a PATCH)
Date: Wed, 16 Feb 2000 11:18:06 +0000 [thread overview]
Message-ID: <38AA876E.64EFE7EE@u.genie.co.uk> (raw)
In-Reply-To: <200002161011.LAA16009@beta.informatik.hu-berlin.de>
Sven Wischnowsky wrote:
> Err, substitution is done in lines 30/31, so your new style only says
> that it should offer expansion only if attempting globbing did change
> the word resulting from substitution (given that I don't really
> understand the style name but maybe I'm the only one). I think it's
> fine to have that configurable.
Globbing wouldn't work without substitution being done first where there are variables etc in the line. The option allows me to have the benefit of globbing (at the expense of substition) in these cases without having substition for everything. So the effect is that only globbed things are substituted hence the name subst-only-globs. If anyone can think of a better name, its easily changed.
> Well, I'd say since the completion code normally adds slashes for
> directories we probably don't need a style for it as long as we add it
> with `-qS/', i.e. auto-removable.
A patch for this follows then.
--- Completion/Core/_expand.bak2 Wed Feb 16 10:58:09 2000
+++ Completion/Core/_expand Wed Feb 16 10:58:18 2000
@@ -7,7 +7,7 @@
# the expansions done produce no result or do not change the original
# word from the line.
-local exp word="$PREFIX$SUFFIX" sort expr expl subd
+local exp word="$PREFIX$SUFFIX" sort expr expl subd suf=" "
local curcontext="${curcontext/:[^:]#:/:expand:}"
# First, see if we should insert all *completions*.
@@ -41,7 +41,7 @@
zstyle -s ":completion:${curcontext}:" glob expr &&
[[ "${(e):-\$[$expr]}" -eq 1 ]] &&
exp=( ${~exp}(N) )
-
+
# If we don't have any expansions or only one and that is the same
# as the original string, we let other completers run.
@@ -60,16 +60,19 @@
[[ "$sort" = (yes|true|1|on) ]] && exp=( "${(@o)exp}" )
+# If there is only one expansion, add a suitable suffix
+(($#exp == 1)) && suf='' && [[ -d $exp ]] && suf='/'
+
if [[ -z "$compstate[insert]" ]] ;then
_description all-expansions expl 'all expansions' "o:$word"
- compadd "$expl[@]" -UQ - "$exp"
+ compadd "$expl[@]" -UQ -qS "$suf" - "$exp"
else
_tags all-expansions expansions original
_requested all-expansions expl 'all expansions' "o:$word" &&
- compadd "$expl[@]" -UQ "$exp"
+ compadd "$expl[@]" -UQ -qS "$suf" - "$exp"
if _requested expansions; then
if [[ "$sort" = menu ]]; then
next prev parent reply other threads:[~2000-02-16 11:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-16 10:11 Sven Wischnowsky
2000-02-16 10:57 ` Bart Schaefer
2000-02-16 11:18 ` Oliver Kiddle [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-02-17 14:43 Sven Wischnowsky
2000-02-16 15:39 Sven Wischnowsky
2000-02-15 16:08 help with _match, globcomplete etc Sven Wischnowsky
2000-02-15 19:53 ` help with _match, globcomplete etc. (with a PATCH) Oliver Kiddle
2000-02-16 6:47 ` Bart Schaefer
2000-02-16 10:38 ` Oliver Kiddle
2000-02-16 11:52 ` Bart Schaefer
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=38AA876E.64EFE7EE@u.genie.co.uk \
--to=opk@u.genie.co.uk \
--cc=zsh-workers@sunsite.auc.dk \
/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).