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

Re: Can this be done with compctl?



    Hi Bart :)

 * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> }     I wanted to simulate the bash behaviour of completing command
> } names if you hit TAB on an empty prompt [...] It seems that compctl
> } don't even try to complete if there is not a word in the prompt :??
> That's partly correct.  TAB is magic in the old compctl system -- it
> is *always* self-inserted when there is only whitespace at the prompt.

    OK, that's the point :(

> can't do so with a TAB unless you create a widget with "zle -C".
> This can of course be as simple as
[...]

    Yes, I thought of it (didn't know that it was as easy as just
removing the 'tab' string from compstate...). I used to think that
the compsys was all bells and whistles and a lot of unreadable shell
code in functions starting with '_', and that compctl could do all
for you. In some way, I still think like that. I mean, for very
simple completions (sort of 'when the command is cd just complete
directory names, not files'), I would use 'compctl'. For me is more
straightforward. For very sophisticated completions I would use
compsys, together with the provided functions, that is, with
_menu_complete (the bells and whistles...). For general I suppose
that I would use a simple dispatcher (far simpler than
'_menu_complete'...) and a liberal use of compadd. By now the only
thing compctl doesn't do for me is command completion in the empty
(just whitespace) command line.

    I must confess that anyway for general use compsys is better.
I've really changed my mind. I still don't use the _menu_complete
thing, because I don't need it (for me, a very sophisticated
completion is sort of 'when the command is tar, just complete .tar.gz
files), but the mechanisms that compsys offers are very good, no
doubt. And anyway, I suppose I should go with compsys, just in case
the zsh workers decide to get rid of compctl... I'll try to decide...

    Thanks a lot for your help, Bart.

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/



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