Zsh Mailing List Archive
Messages sorted by:
Re: completion & read, vared
- X-seq: zsh-users 1672
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Heinz Deinhart <emperor@xxxxxxxxx>
- Subject: Re: completion & read, vared
- Date: Mon, 13 Jul 1998 18:45:10 -0700
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <Pine.LNX.3.96.980713200430.4708A-100000@xxxxxxxxx>
- References: <Pine.LNX.3.96.980713200430.4708A-100000@xxxxxxxxx>
On Jul 13, 8:19pm, Heinz Deinhart wrote:
> Subject: Re: completion & read, vared
> On Mon, 13 Jul 1998, Bart Schaefer wrote:
> > On Jul 13, 1:10pm, Heinz Deinhart wrote:
> > } Subject: completion & read, vared
> > }
> > } is there a way to use completion with any realine-like function ?
> > Not directly; "read" inputs characters one at a time, for some reason,
> > even when not in raw mode.
> hmm, maybe i'm missing something, but
No, it is I that missed something.
You meant "... use completion with _every_ readline-like function?"
I parsed "... use completion with one of the readline-like functions?"
The answer to the former question is, no, there isn't.
The answer I gave was to invent a readline-like function that uses vared
to perform completion, which may be interesting but isn't what you wanted.
> > } vared uses completion, but i cant figure out how to change its behaviour.
> > Change its behavior how?
> it would be cool if vared had a completion option (maybe -C)
> "vared -p 'enter a username> ' -C '-u' returnvar"
> "emp<TAB>" expands to "emperor"
> ^^^^ the compctl options that vared
> should use in input-line
Completion within vared appears to work exactly as if it were parsing a
command line; e.g. it completes commands in the leftmost word, then does
the completions for those commands in succeeding words, etc. Arguably
this isn't the most useful behavior. (For more fun, try invoking the
binding for run-help while you're doing a vared; the results are not very
To get the effect that you specifically asked for above, you need to change
the default completion by using "compctl -T", then restore the default when
vared has exited. E.g.,
compctl -Tx 'W[0,*]' -u
As usual, one can't attempt something like this without running into another
zsh oddity. In this case,
compctl -T -u
is accepted and appears in the "compctl -L" output, but is a no-op. There
has to be a -x option and a pattern before -T will do anything at all. The
manual says -T "is only useful when combined with extended completion" but
here's a case where (a) it's useful WITHOUT extended completion and (b) it
fails mysteriously when used in the obvious way.
We should strive to prevent this sort of thing.
Anyway, 'W[0,*]' means accept anything in word zero (the command position)
which is the closest you can get to having no pattern at all.
Messages sorted by: