Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
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 <d.s@daniel.shahaf.name>
To: Bart Schaefer <schaefer@brasslantern.com>
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)
X-Seq: zsh-workers 37549

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" <CURSOR>^W
> }     becomes
> }     % echo foo <CURSOR>
> 
> 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!

