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

Re: is there way to use vicmd (not viins) layout initially?



Peter Stephenson wrote:
>Unfortunately, if you do that, although the shell starts in vicmd mode,
>you can't get into viins mode, because the code which implements
>`vi-insert' switches to the main keymap, i.e. in this case straight back
>to vicmd.  This is actually documented, but I'm not sure if it's
>necessary.

I believe the intent was that in Emacs mode one could switch to
vi command mode and then switch back to Emacs mode by invoking an
insert command from the vicmd keymap.  That is, one can have vi-style
modal editing with the insert mode keymap actually being Emacs mode.
Changing the vi insert commands to switch to the "viins" keymap would
make this impossible in the current keymap arrangement.  It would still
be possible to get a similar effect by making "viins" an alias for the
"emacs" keymap, but this is an extra setup step and comes at the expense
of the real vi insert mode keymap.

I suggest that to achieve starting editing in vi command mode what one
wants to do is select the "vicmd" keymap instead of "main" when the editor
is invoked.  Perhaps there could be a specially-named widget that, if it
exists, gets invoked as soon as ZLE has started up to start editing a new
command line; this would be the in-ZLE equivalent of the precmd function.

-zefram



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