From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20183 invoked from network); 6 Jan 2022 01:53:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Jan 2022 01:53:17 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1641433997; b=nyNB1S093d5rxab5zg/ClIWwyZUr1BZqxCsPXLKrSyqFxKn01Z0qN+lr3owjkvWecYTM7l3p1i 5gAPkCLjBS0ZiE4G7rf1WY+zacbFu+qqFSYY+COg15hlpGW8hSJiAecHIcN+G8PqAkqfZfY9J1 hesbekrXJrktI9m5xVumOg0JIYxBg1EdKZxy1ZvewzRjyUZHQ3pINngzsBDnwZVLtkkU8bSlqB unzoWMgkpgnvVExFL10BmEGpjxC3gkkeX6bLhl4jtmiHybRf0Uv6NeqdQ136OnSu36Y6eRz1xk 4dwOGTe6Ddlm2JjZb3yAabSV32T2cGDH6Nrn4E2yhaJ/kQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (pepin.polanet.pl) smtp.remote-ip=193.34.52.2; dmarc=none header.from=polanet.pl; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1641433997; bh=Qwqq88R5epIntkf22wQ21+zXegt38naUcf9EGKkpLr0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature; b=cw1kPY47E/mXijIHmLfOAgaDA65XCOhuvmuxjq9Y9EIgSCEnWLEQehzMOsyhK0JdgFOaQkeZqm cdKvMvLT/rV3211W5SnlcCu9/DYDRm96ZKp3+MqeNqCMbUQOZHTo+K/Dqq1w4aExC2PTEeiMIM MiB5jpQ2kViZhiFaNDDLsvbjffvJzULEXx/um7BRK4JHvd/y4yH1eRqHOZ5nszYIrmUc4X0OrG S5tM0BIVAJYaTcQU1ZqfTDCh9ldYe3gq8kNLecxeH2VJRY09u6gM8VnABi2ity1FrIUCAeSYOt Ckxk0Gdrcl+T304UIcy30AcQyn/ihMcO+L6WfJJ2bNBN5A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=7MakCW4tSRk37eon9DjNFKGHXR7Hb4lI9aFrJKQ+fJ4=; b=UJPzzX8rgz3WGEPJiLkIwkmovU VkvBgvdGot6AvwrQtpQKjHCXAw90dbNvnzfwMQ72VB2wIWvf+MmM096VpL6kPDwFgjajen0M4WMqe EyMI7d2dvhCjAlXA/be5ThNRaGptwLAPi2tlenelrLmrWVuOwyFeeFm4vCwaV9J6l6Ykf12hxIocv mjduTtUOxlqJTsO1TfeM7q3506zs8ERdyqJhDhw+1CQ8MhKPaXoyarlABmhzR3nba8YciMVGTi0jX CHa4b07oTEkZzG+5r8peOn7Ok9flHux7BdEs1vwB079AgBrveny+r/ZocdbL29a1yW4thRWXYywQF zc2QjxCA==; Received: from authenticated user by zero.zsh.org with local id 1n5Hxs-000Mey-S6; Thu, 06 Jan 2022 01:53:16 +0000 Authentication-Results: zsh.org; iprev=pass (pepin.polanet.pl) smtp.remote-ip=193.34.52.2; dmarc=none header.from=polanet.pl; arc=none Received: from pepin.polanet.pl ([193.34.52.2]:56450) by zero.zsh.org with esmtps (TLS1:DHE-RSA-AES256-SHA:256) id 1n5Hx0-000Ly6-DI; Thu, 06 Jan 2022 01:52:22 +0000 Date: Thu, 6 Jan 2022 02:52:21 +0100 From: Tomasz Pala To: Bart Schaefer Cc: Zsh Users Subject: Re: _complete: insert unambiguous when globbing Message-ID: <20220106015221.GA12608@polanet.pl> References: <20220103123903.GA20434@polanet.pl> <20220105194643.GA13958@polanet.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Seq: 27454 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Wed, Jan 05, 2022 at 12:11:54 -0800, Bart Schaefer wrote: > Aha! That's given me the answer. > > You want something along the lines of: > > unsetopt globcomplete > zstyle ':completion:*' completer _complete _match _expand > zstyle ':completion::match:*' insert-unambiguous true Smart one! This is nice, but this time I got other issues: $ rpm --*er[tab] without glob_complete, this method of finding options for SOME commands stops working. What's the difference between ps --* and ls --* that the latter still works? And back to my example: $ touch 2021.12.29-14:41:02.xz 2021.12.29-19:41:02.xz 2021.12.30-03:41:03.xz 2021.12.30-14:41:04.xz 2021.12.30-19:41:02.xz 2021.12.31-03:41:02.xz 2021.12.31-14:41:04.xz 2021.12.31-19:41:03.xz $ ls *04[tab] - this one is much nicer than my version, goes directly to: $ ls 2021.12.3-14:41:04.xz (note the suffix) with cursor __^__ placed here, on dash. However, unless I move cursor left+right manually, pressing tab second time moves cursor to the end with uncompletable line... And following one fails miserably... $ ls *z[tab] $ ls 2021.12.- See the dash at the end? From now on, no completion... This problem is solved by alternating order to _expand _complete _match. Apparently _complete _match parts doesn't work well here in that order, however _match _complete (only!) works just like my solution without compstate[old_list]=keep, therefore one of the following seems to work fine: zstyle ':completion:*' completer _match _oldlist _complete zstyle ':completion:*' completer _expand _match _oldlist _complete _prefix But no suffix added, just like in my version. Moreover, in this order there's no need to unsetopt glob_complete. Am I missing something? There is still one issue with coloring completions, that works fine with my approach, but seems to be stuck on _oldlist: highlights='${PREFIX:+=(*/|)(#bi)($PREFIX|$PREFIX:t)(?)(*(${LASTSEARCH})*)#*==1;32=1;31==1;32}':${(s.:.)LS_COLORS} zstyle -e ':completion:*:*' list-colors 'reply=( "'$highlights'" "ma=44;1;33")' With _oldlist in action the colors are not updated after prepending the unambiguous part. > The use of insert-unambiguous will set compstate[pattern_insert] > correctly for you. You might also try the value "pattern" for that > zstyle. -- Tomasz Pala