Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: backward-kill-shell-word widget
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!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author