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

Re: Can this be done with compctl?



On Oct 18,  6:17pm, DervishD wrote:
}
}     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.
You can complete at an empty prompt by binding *another* character to
expand-or-complete (or any of the builtin completion widgets), but you
can't do so with a TAB unless you create a widget with "zle -C".

This can of course be as simple as

    function x-or-c {
	compstate[insert]="${compstate[insert]//tab /}"
	compcall
    }
    zle -C expand-or-complete expand-or-complete x-or-c

(That is, override the builtin expand-or-complete, so no bindkey changes
are required.)



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