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

Re: How do I disable the mode for using j-k keys to scroll through history?

On Tue, Mar 15, 2022 at 4:02 PM Steve Dondley <s@xxxxxxxxxxx> wrote:
> On 2022-03-15 06:55 PM, Steve Dondley wrote:
> >>
> >> Are you sure you want to disable it?  Why are you using vi commands if
> >> you never want to be in command mode?
> >
> > Because I want the insert mode commands.

There is one "insert mode command" that works slightly differently
than emacs mode, and that's ^W for vi-backward-kill-word.
vi-kill-line would work differently, but you'd have to have exited
from and then re-entered insert mode to notice.  (Of course there are
MORE commands in emacs mode, all bound to ctrl+something.)

> > I have no idea how I would
> > use vi command mode from a command line.

Example:  Hit ESC, and then hit "b" twice to move backward two words,
and then hit "cw" to change the word you're on.

Or:  Hit ESC, and then "I" to go to insert something at the beginning
of the command, and then ESC and "A" to go back to appending at the

Do you never move left and right except one character at a time with
the arrow keys, or by deleting?

> At a minimum, I need to change the bind key for entering command mode so
> it's not accidentally triggered.

To see what's bound:
bindkey -M viins

You're interested in anything that's bound to vi-cmd-mode, e.g.:
"^[" vi-cmd-mode

To remove that:
bindkey -M viins -r '^['

To add a different one, in this example two ESC in sequence:
bindkey -M viins '^[^[' vi-cmd-mode

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