From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 13799 invoked from network); 21 Mar 2020 20:06:55 -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 unknown (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTP; 21 Mar 2020 20:06:55 -0000 Received: (qmail 18578 invoked by alias); 21 Mar 2020 20:06:49 -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: 45596 Received: (qmail 14551 invoked by uid 1010); 21 Mar 2020 20:06:49 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25751. spamassassin: 3.4.2. Clear:RC:0(66.111.4.26):SA:0(-2.6/5.0):. Processed in 0.727732 secs); 21 Mar 2020 20:06:49 -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: gggruggvucftvghtrhhoucdtuddrgedugedrudegfedgudefgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfgjfhfogggtgfesth hqtddtredtjeenucfhrhhomhepffgrnhhivghlucfuhhgrhhgrfhcuoegurdhssegurghn ihgvlhdrshhhrghhrghfrdhnrghmvgeqnecukfhppeejledrudekvddrudeftddrudefhe enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhs segurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Date: Sat, 21 Mar 2020 20:06:11 +0000 From: Daniel Shahaf To: Rik Cc: zsh-workers@zsh.org Subject: Re: Make `Ctrl + W` and `Ctrl + Shift + H` in zsh behave the same as in bash Message-ID: <20200321200611.7e677d21@tarpaulin.shahaf.local2> In-Reply-To: <63c88bc3-ab0b-dd26-4dcd-4c834b5bfaad@posteo.net> References: <63c88bc3-ab0b-dd26-4dcd-4c834b5bfaad@posteo.net> 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 Rik wrote on Sat, 21 Mar 2020 14:29 -0500: > I've recently started using zsh and I like it. However, coming from=20 > bash, some little things I miss. >=20 Welcome! > *The problem:* >=20 > In bash behavior is like this: >=20 > * Ctrl + W deletes the word behind the cursor up to the next space > * Ctrl + Shift + H deletes the word behind the cursor up to the next > seperation charcater like ., ,, -, / etc. >=20 > In zsh both Ctrl + W an Ctrl + Shift + H behave like the latter one in=20 > bash. I would like the same behavior as in bash. >=20 >=20 >=20 > *This is what I've tried:* >=20 > SPACE_WORDCHARS=3D'~!#$%^&*(){}[]<>?.+;-_/\|=3D@`' =20 > backward-delete-word() WORDCHARS=3D$SPACE_WORDCHARS zle .$WIDGET > zle -N backward-delete-word > bindkey "^W" backward-delete-word >=20 > This works, however, it breaks the functionality that deleting a word=20 > puts the word on the paste buffer, so I can't then paste this word with=20 > Ctrl + Y. This is quite important functionality for me. To be honest I'm= =20 > not completely sure how this zle function works and what .$WIDGET does.=20 > Would anyone know a way how I can make this work while retaining the=20 > cut/paste behavior? Deleting those four lines and adding just =C2=ABWORDCHARS=3D'~!#$%^&*(){}[]= <>?.+;-_/\|=3D@`'=C2=BB instead seems to do what you want. (I also tried calling =C2=ABzle -f kill=C2=BB in the wrapper but it didn't = have the desired effect.) Regarding $WIDGET, it's a parameter that gets predefined by zle when widget functions are invoked. In the example, its value will be "backward-delete-char". Thus, net effect of =C2=ABzle .$WIDGET=C2=BB will = be to call the builtin "backward-delete-char" widget. For a simpler example, consider: mywidget() { LBUFFER+=3D"x" } zle -N mywidget bindkey "y" mywidget With this, every time you press "y", you'll get an "x" inserted. (You can just paste this example at the prompt to try it.) Cheers, Daniel