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

Setting the cursor position upon completion



Hi,
I've come to you cause I'm having some trouble setting the cursor position upon completion, and I didn't find a satisfying solution on the web.
My TAB key is bound to the expand-or-complete-prefix widget and I've set the MENU_COMPLETE option in order to cycle through all the matches right from the first TAB hit.
The thing is, when cycling through the matches, the cursor is always moved to the end of each match, which I don't want.


Here is the behaviour I'm looking for:

When hitting TAB for the first time and the first match is inserted,

(1) if there is more than one match and all of them share a common unambiguous prefix, then move the cursor to the position immediately following the prefix (that is the first ambiguous character).

(2) if there is more than one match but they do not ALL share a common prefix, then leave the cursor where it was before hitting TAB. This is actually implied by (1).

(3) if there is only one single match, then move the cursor to the end of the match inserted.


The default behaviour already satisfies (3). But I can't seem to find a solution for the other two.

I've tried the following command to solve (1), but unfortunately it didn't help and I don't understand why.
zstyle ':completion:*' ambiguous true

I've unset the ALWAYS_TO_END option (even though it's already the case by default) but it didn't change anything. Set or unset, the cursor is always moved to the end of the match. Does anyone know the point of this option ?


Hope the description and my English weren't too confusing.
Any help would be greatly appreciated.

Thanks,
Julien


Envoyé avec Yahoo! Mail.
Une boite mail plus intelligente.

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