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

Time for an obscure completion question



Given the completion styles (straight out of compinstall except for moving
the _ignored completer):

zstyle ':completion:*' completer _oldlist _expand _complete _match _ignored _approximate _prefix
zstyle ':completion:*' match-original both
zstyle ':completion:*' matcher-list '' 'r:|[._-,]=* r:|=*' 'm:{a-zA-Z}={A-Za-z} r:|[._-,]=* r:|=*' 'r:|[._-,]=* r:|=* l:|=*'
zstyle ':completion:*' max-errors 2 numeric
zstyle ':completion:*' original true

If I have a directory named "foodatthe/Bar" (to borrow from PWS) and I type:

zsh% cd *at/ba<TAB>

I'm offered the two completions

foodatthe/    *at/ba

This is apparently what I asked for, but it's not what I want. I want the
"original" as considered by _approximate to be the output (for lack of a
better word) of _expand _complete _match.  That is, if there's exactly one
possible expansion of the part with the pattern, then I want that accepted
so that the menu becomes:

foodatthe/Bar   foodatthe/ba

Ignoring that for the moment ... if I type

zsh% cd *at/ba<C-x h>

i.e., invoke completion help, I see a set of contexts and then the possible
completions at the end.  So far so good, but now if I hit TAB the argument
gets erased and I'm left with

zsh% cd 
        ^ cursor here

A similar thing happens here:

zsh% cd *at/ba<TAB><C-e><TAB><TAB><TAB>
zsh% cd  
         ^cursor

The first TAB gives "foodatthe/ba" and lists two completions; I hit C-e to
break out of menu completion (is there a better way?) and TAB again which
gives me the correction "foodatthe/Bar/" and again lists two completions.
Hit TAB again and there's a feep; hit TAB a third time and the argument
vanishes, replaced by a space.  I would have expected it to just keep on
feeping at me for as long as I bang on tab.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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