Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion in the first character position



Oliver Kiddle wrote:

> I am writing a shell script where I'm prompting the user to enter
> various information. I'm using vared to read what is entered into a
> variable after using compctl -C to setup completions (and a setopt
> autolist). I could have used the new style completions but it is a
> fairly simple case and I use 3.0.8 where the script will run.
> 
> The problem is that when I press tab to complete in the first character
> position, a tab is inserted and the completions are not listed. This is
> handy at the normal zsh prompt because listing all the commands can be
> time consuming but in my script, it is annoying.
> 
> Is there an option or something to turn this off? I've looked through
> the manual but can't see one. As a feature, it is probably less useful
> with the new completion system because the same can be achieved with a
> style anyway.

Yes, since this is possible in the new completion system (even the
default there, inside vared), I guess we won't add an option for it.

You can use a trick. The tab is only inserted if the last character in 
the key binding used to call the completion code was a tab. So:

  bindkey -s '\t' '\ec'  # or something better than \ec
  bindkey '\ec' complete-word

Ok?

And now you wish for vared-local keymaps, of course ;-)


Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author