[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] How to make vi-insert mode's ctrl-w work in the 4.3 way?
From: |
Clark Wang |
Subject: |
Re: [Help-bash] How to make vi-insert mode's ctrl-w work in the 4.3 way? |
Date: |
Fri, 4 Nov 2016 23:52:48 +0800 |
On Fri, Nov 4, 2016 at 10:32 PM, Chet Ramey <address@hidden> wrote:
> On 11/4/16 6:30 AM, Clark Wang wrote:
> > For example, if I have inputted the following after the prompt:
> >
> > # foo "abc"
> >
> > In bash 4.3's vi-insert mode, when I press ctrl-w it'll delete the whole
> > "abc" (including quotes). But with 4.4 I have to press ctrl-w for 3 times
> > (one for the right " char, one for abc and one for the left " char).
>
> This was changed due to a bug report about readline not being Posix-
> conformat with its ^W binding in vi insert mode. Posix specifies that
> word boundaries include whitespace and punctuation. Apparently vi is
> the same, but I'm not enough of a vi user to say.
>
> The old binding (unix-word-rubout) is still there, but to avoid it being
> overwritten, you need to set the readline variable `bind-tty-special-chars'
> to `off'. (Since ^W is your default stty werase character, readline will
> bind it to its vi-mode equivalent when that variable is enabled.)
>
This works great. Thanks Chet.
>
> You would have noticed the ^W binding being overwritten if you had done
> a `bind -m vi-insert -p' after one of your key binding commands, but I
> suppose there isn't any real reason to do that.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU address@hidden http://cnswww.cns.cwru.edu/~
> chet/
>