zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Phil Pennock <phil@athenaeum.demon.co.uk>,
	Zsh Development Workers <zsh-workers@math.gatech.edu>
Subject: Re: Non-intuitive completion
Date: Mon, 30 Nov 1998 22:28:47 -0800	[thread overview]
Message-ID: <981130222847.ZM3321@candle.brasslantern.com> (raw)
In-Reply-To: <19981201024758.60618@athenaeum.demon.co.uk>

On Dec 1,  2:47am, Phil Pennock wrote:
} Subject: Non-intuitive completion
}
} Also, this isn't necessarily a bug, as it's 'daft' on my part.  But the
} results are counter-intuitive, to me at least.
} 
} athenaeum% print $ZSH_*<TAB>
} 
} At which point the leading $ZSH_ is completely ignored and removed, and
} the * is expanded out to files in the current directory, as per usual.
} 
} Nothing special about the above choice of variable, except that <TAB>
} after the Z provides the next three characters.  I'm lazy and wanted
} both, so tried '*' to see what zsh would do.  I /know/ it's a filename
} glob, but shouldn't the leading text have some effect instead of being
} treated as null?

The default binding for tab is expand-or-complete.

The $ZSH_ is "treated as null" because as soon as you insert the '*' you
aren't doing completion any more, you're doing expansion.  The expansion
of $ZSH_ is empty if $ZSH_ is not set, so it vanishes.

If you don't want to switch on the fly from completion to expansion in
that way, then you have to rebind tab to complete-word.  Try

zsh% bindkey '^I' complete-word
zsh% print $ZSH_*<TAB>

Now it just feeps at you, because a '*' can't appear in a variable name.

Now, if you'd like to see some REALLY strange behavior, which definitely
IS a bug in my book, try

zsh% bindkey '^I' expand-or-complete
zsh% setopt nounset
zsh% print $ZSH_*<TAB>

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1998-12-01  6:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-01  2:47 Phil Pennock
1998-12-01  6:28 ` Bart Schaefer [this message]
1998-12-03 11:48 Sven Wischnowsky
1999-03-13 17:26 ` Bart Schaefer
1999-03-15 10:06 Sven Wischnowsky

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=981130222847.ZM3321@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=phil@athenaeum.demon.co.uk \
    --cc=zsh-workers@math.gatech.edu \
    /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).