Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: multibyte implementation (for filename completion with umlauts)
- X-seq: zsh-users 23683
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: multibyte implementation (for filename completion with umlauts)
- Date: Tue, 25 Sep 2018 19:15:43 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=	daniel.shahaf.name; h=content-transfer-encoding:content-type	:date:from:in-reply-to:message-id:mime-version:references	:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=ZeaJ64	1uK5aIlpsUI34Ph4nPOget6we+1PdpzXkK+qE=; b=l7kx0fJoqcTL3TTVvIxRl5	KQ49rXHB4HaAJuckUM6m22Dea/DmAcr5WVQ5TLK1nm4fPAgwPHORPxGX+/PK1xC/	e9LaKOyAnnI7Grm4fX4NxL9lNCHUSpkQDuRWWY7ezBfWHz4eS/cQKphfjGKalnin	tSYwhSTLXrGHqn6i3n7fk5EJG/TAmLpThbOASyChzeX76Py9OVfT0m4rsieFOReP	Xxci3qHUsi+UgdlNrjSPBcn4npgDfZ22U3cWlj9Ad5/7s1PkUKG5imBIo8SypXE2	w4MfJfFTsCLuF6jJ0IhEjQLWfB7yxSA2Wi6FbIkjhwhRLmSq6M6InsEXqy2Nr+mA	==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=	messagingengine.com; h=content-transfer-encoding:content-type	:date:from:in-reply-to:message-id:mime-version:references	:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=ZeaJ64	1uK5aIlpsUI34Ph4nPOget6we+1PdpzXkK+qE=; b=LyfYemLEkKbFaOMwnbI2C8	UF9KHessCLWd/4BVYeszOskf9i1pb1uTl5fKrd/K0WCVAFpNp0wq+5F20jdWPBqq	nNRktIPhTPgr4Z3t6hlAO48ecU0hRCVWB7TVvHBjkWwEdDsNWpfSXPTBUFLRpELb	Y0jZ74o5bTXpo+hxtLktMRqZT4D4VmWBkAc7on3Ib9+3PmyWt0uTKj3mmWcHBH4e	712MOzgf/7+mwdAwpT9dpa/ouRRbEJdwXCSE+jwWwN2dHXxJqPzuYel8EjyBvOzY	8otMdX1rwC8wInl9YFnAew2bl8XRWorC/bcONsa3pxkT6I8l+vtpBge8Szgc81jg	==
- In-reply-to: <20180925164728.uhxbw4aafcbzmyn4@spiegl.de>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20180920101403.unp6epfpqllzzqov@spiegl.de> <20180920160535.oiflfeb6zxckhfte@tarpaulin.shahaf.local2> <20180925164728.uhxbw4aafcbzmyn4@spiegl.de>
> > 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