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 14601 invoked from network); 21 Mar 2020 20:13:27 -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:13:27 -0000 Received: (qmail 13262 invoked by alias); 21 Mar 2020 20:13:21 -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: 45597 Received: (qmail 29082 invoked by uid 1010); 21 Mar 2020 20:13:21 -0000 X-Qmail-Scanner-Diagnostics: from mout02.posteo.de 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(185.67.36.66):SA:0(-4.3/5.0):. Processed in 0.770776 secs); 21 Mar 2020 20:13:21 -0000 X-Envelope-From: gitaarik@posteo.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at posteo.de designates 185.67.36.66 as permitted sender) Subject: Re: Make `Ctrl + W` and `Ctrl + Shift + H` in zsh behave the same as in bash To: Daniel Shahaf Cc: zsh-workers@zsh.org References: <63c88bc3-ab0b-dd26-4dcd-4c834b5bfaad@posteo.net> <20200321200611.7e677d21@tarpaulin.shahaf.local2> From: Rik Message-ID: <5d798522-f2f7-0017-f62c-e5748eaecdce@posteo.net> Date: Sat, 21 Mar 2020 15:12:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200321200611.7e677d21@tarpaulin.shahaf.local2> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Hey Daniel, Thanks for your explanation! Yes just using WORDCHARS will work, but that will also change the behavior of Ctrl + Alt + H. I want that to keep deleting *partial* words. Greets, Rik On 21-03-2020 15:06, Daniel Shahaf wrote: > Rik wrote on Sat, 21 Mar 2020 14:29 -0500: >> I've recently started using zsh and I like it. However, coming from >> bash, some little things I miss. >> > Welcome! > >> *The problem:* >> >> In bash behavior is like this: >> >> * 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. >> >> In zsh both Ctrl + W an Ctrl + Shift + H behave like the latter one in >> bash. I would like the same behavior as in bash. >> >> >> >> *This is what I've tried:* >> >> SPACE_WORDCHARS='~!#$%^&*(){}[]<>?.+;-_/\|=@`' >> backward-delete-word() WORDCHARS=$SPACE_WORDCHARS zle .$WIDGET >> zle -N backward-delete-word >> bindkey "^W" backward-delete-word >> >> This works, however, it breaks the functionality that deleting a word >> puts the word on the paste buffer, so I can't then paste this word with >> Ctrl + Y. This is quite important functionality for me. To be honest I'm >> not completely sure how this zle function works and what .$WIDGET does. >> Would anyone know a way how I can make this work while retaining the >> cut/paste behavior? > Deleting those four lines and adding just «WORDCHARS='~!#$%^&*(){}[]<>?.+;-_/\|=@`'» > instead seems to do what you want. > > (I also tried calling «zle -f kill» 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 «zle .$WIDGET» will be to > call the builtin "backward-delete-char" widget. For a simpler example, > consider: > > mywidget() { LBUFFER+="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