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=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25560 invoked from network); 10 May 2020 14:22:35 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 10 May 2020 14:22:35 -0000 Received: (qmail 28623 invoked by alias); 10 May 2020 14:22:23 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45810 Received: (qmail 4495 invoked by uid 1010); 10 May 2020 14:22:23 -0000 X-Qmail-Scanner-Diagnostics: from out3-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25801. spamassassin: 3.4.4. Clear:RC:0(66.111.4.27):SA:0(-1.1/5.0):. Processed in 5.353094 secs); 10 May 2020 14:22:23 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrkeekgdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfgjfhfogggtgfesthhqtd dtredtjeenucfhrhhomhepffgrnhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgv lhdrshhhrghhrghfrdhnrghmvgeqnecuggftrfgrthhtvghrnhephfdtteefheevuedthe dutdeifeegteettdejtdffheduieeijeelteetkeduteehnecukfhppedutdelrdeiiedr udehrddvfeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Date: Sun, 10 May 2020 14:21:36 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: [PATCH] expand '..n' to equivalent number of '..' segments in fixdir Message-ID: <20200510142136.282ecedb@tarpaulin.shahaf.local2> In-Reply-To: <01329055-ca28-e00f-0fd2-34c619371fbb@gmx.com> References: <2de46d1c-8e9a-6666-e3a9-cda34f03f487@gmx.com> <01329055-ca28-e00f-0fd2-34c619371fbb@gmx.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Eric Cook wrote on Sun, 10 May 2020 03:09 -0400: > On 5/10/20 3:06 AM, Eric Cook wrote: > > I personally think a wrapper function is more appropriate. =20 >=20 > One not distributed with zsh itself that is. Or a shell widget, like Mikael's rationalise-dot widget that lets one type =C2=ABcd ...=C2=BB to get =C2=ABcd ../..=C2=BB and so on. This also h= as the benefit of not requiring completion functions to be taught about the new syntax. I don't have his latest version handy, but I use a modified version: _rationalise-dot2 () { if [[ $LBUFFER =3D=3D *( ) ]] then zle .self-insert return fi local -a tokens; tokens=3D(${(z)LBUFFER})=20 if [[ $tokens[-1] =3D=3D (../|*/../) ]] then LBUFFER+=3D../=20 elif [[ $tokens[-1] =3D=3D '.' ]] then LBUFFER+=3D./=20 else zle .self-insert fi } zle -N _rationalise-dot2 bindkey . _rationalise-dot2 bindkey -M isearch . self-insert The zle calls inside the function don't pass argv through, but that doesn't matter in practice. Tweak to taste.