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

Re: multibyte implementation (for filename completion with umlauts)



> > Therefore, how about writing a widget
> > that does s/ẍ/xe/ (for x in a,o,u,A,O,U) before attempting completion.
> > Would that be a workaround?
> Yes, that sounds like a (pretty wicked hehe) workaround.
> 

Unfortunately, I just now see that while «fooae<TAB>» does complete to
«FOOÄBAR», «fooaeb<TAB>» does not.

> What would a widget like that look like?
> I am really bad at zsh regexp and search/replace strings. :-(

The string manipulation is the easy part:

    % () { local s=$1; s=${s//ö/oe}; typeset -p s } fööbar
    foeoebar

The trickier part is how to change only the last word on the command line.
I can think of a few options here, but I'm not sure what to recommend; perhaps
manipulate the end of $LBUFFER, consulting $words[CURRENT] to find the
beginning of the word before the cursor?  As you say later, perhaps using
_correct, or something modeled after it, would be better.

> While playing around I found a completer behaviour I cannot explain:
> % touch testüng
> % ls testün<TAB>   --> "ls testüng"
> % ls testÜn<TAB>   --> BINGs
> % ls Testün<TAB>   --> also just BINGs
> 
> Shouldn't
>  zstyle ':completion:*' matcher-list 'm:{A-ZÄÖÜa-zäöü}={a-zäöüA-ZÄÖÜ}
> take care of the capital T?
> Apparently this one multibyte character screws up the whole completion process?
> 

The capital T example for me if I change the order to m:{A-Za-zÄÖÜäöü}={a-zA-ZäöüÄÖÜ}.

> However, if I add
>  zstyle ':completion:*' completer _complete _match _correct
> then "ls Testün" and even "ls testÜn" is corrected/completed fine.



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