Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: vi-mode zle: how to delete past the start char of insert mode (like VIM 'backspace'=start option)



On 27/09/2009, Peter Stephenson <p.w.stephenson@xxxxxx> wrote:
> On Sun, 27 Sep 2009 16:03:53 +0200
> Anton Sharonov <anton.sharonov@xxxxxx> wrote:
>> How can I tell zshzle that I like to be able to delete past the
>> point of _start_ of the insert mode ?
>
> Replace the "vi-" style bindings with the non-vi equivalents, which
> don't care about the insertion point.
>
> bindkey -M viins '^h' backward-delete-char
> bindkey -M viins '^?' backward-delete-char
> bindkey -M viins '^w' backward-kill-word
>
> etc.

I can confirm, works fine for me.

>
> You can be a bit smarter by replacing the widgets themselves,
>
> zle -A .backward-kill-word vi-backward-kill-word
> zle -A .backward-delete-char vi-backward-delete-char
>
> which means you don't need to worry about what they're bound to them.

Awesome, this works as well !


For now I will just write down all the possibilities you showed
me, and since I don't know which one is better,
I will stick with the following suggestion

# from the zsh-user, Bart Schaefer:
bindkey "^W" backward-kill-word    # vi-backward-kill-word
bindkey "^H" backward-delete-char  # vi-backward-delete-char
bindkey "^U" backward-kill-line    # vi-kill-line
bindkey "^?" backward-delete-char  # vi-backward-delete-char

Thanks for your help !

-- 
Anton

>
> --
> Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
> Web page now at http://homepage.ntlworld.com/p.w.stephenson/
>



Messages sorted by: Reverse Date, Date, Thread, Author