From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9879 invoked by alias); 10 Jan 2016 19:53:27 -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: X-Seq: 37549 Received: (qmail 6826 invoked from network); 10 Jan 2016 19:53:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Date: Sun, 10 Jan 2016 19:53:23 +0000 From: Daniel Shahaf To: Bart Schaefer Cc: zsh-workers@zsh.org Subject: Re: backward-kill-shell-word widget Message-ID: <20160110195323.GA23064@tarsus.local2> References: <20160110003758.GA28696@tarsus.local2> <160110091744.ZM585@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <160110091744.ZM585@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) Bart Schaefer wrote on Sun, Jan 10, 2016 at 09:17:44 -0800: > On Jan 1, 12:37am, Daniel Shahaf wrote: > } > } This widget is like ^W but for "shell words" rather than > } whitespace-separated words, so > } > } % echo foo "bar baz" ^W > } becomes > } % echo foo > > As of 5.0.8 you can do this with: > > backward-kill-shell-word() { > zle select-in-shell-word > ((++CURSOR)) # adjust for vi vs. emacs region > zle kill-region I'd add: LBUFFER+=" " Without that, LBUFFER[-1] after the widget is the last character of the preceding word. > } > > I'm not sure if that CURSOR adjustment is a a bug or just a necessary > evil because of using vi binding in the emacs keymap. Thanks for the additional solution!