Zsh Mailing List Archive
Messages sorted by:
Re: Getting completion to tell the user what to do
- X-seq: zsh-users 2455
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxxxxxx
- Subject: Re: Getting completion to tell the user what to do
- Date: Tue, 20 Jul 1999 08:53:51 +0000
- In-reply-to: <199907200708.JAA00727@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <199907200708.JAA00727@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Jul 20, 9:08am, Sven Wischnowsky wrote:
} Subject: Re: Getting completion to tell the user what to do
} Bart Schaefer wrote:
} > What I want is to offer no completions at all [...]
} > but print a hint to the user as to what he's supposed to type.
} > What obvious thing have I forgotten/overlooked here? Is there an entirely
} > better alternative to using compadd -X ?
} Time for dirty tricks:
} compadd -UX 'Please...' -n ''
Oho -- undocumented dirty tricks, no less. The compstate[insert] doc
doesn't give any hint that it can be set but empty. Of which case that
is documented is this a degenerate?
} You need the -U because otherwise the empty string never matches
} what's on the line (not even the empty string on the line).
Really? When I first tried
compadd -X 'Please ...' ''
(without the -S) then every time I pressed TAB a single space got inserted
(the suffix). If the empty string isn't a match, why did that happen?
} Then we can switch off insertion completely.
So that's what compstate[insert]='' means?
} If you want the string to be listed only on a TAB with an empty string
} you can do `compadd -X "Please..." -n dummy' -- i.e. add a string with
Presumably then "dummy" should be something that can't possibly match?
Or does that not matter?
} The -n, of course, is just to be sure that the matches are not visible.
} Is that good enough?
It's just marvelous, thanks. One question, though -- I thought that we
made kill-whole-line erase the completion listing, but it doesn't seem to
do that in this case:
zagzig% mail -s <TAB><C-u>
leaves me with
Please enter a descriptive subject
which is rather annoying when I start in typing some completely different
command and doing completions for it that don't themselves produce a list.
Bart Schaefer Brass Lantern Enterprises
Messages sorted by: