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

Re: visual/viopp modes are not detected by zle-keymap-select

On Feb 23, 11:34pm, Hugh X wrote:
} The recent zsh 5.2 supports more vi modes including visual and viopp. When
} I switched from vicmd to visual, the zle-keymap-select fails to capture the
} keymap change in $KEYMAP. Please let me know if there is a way to indicate
} the current editor state enters the visual-mode. Thanks.

The zle-keymap-select hook is not called for "local" keymaps, which for
the most part means those that are active within the context of another
built-in widget invoked from one of the other keymaps.  Local keymaps
currently include:

command - inside execute-named-command
isearch - incremental search
listscroll - in completion lists
menuselect - in menu selection
viopp - reading bounds of vi range operator
visual - active region in vicmd

The reason for this is that local keymaps generally each have a special
interpreter for the widget bindings, and can't be allowed to branch off
to arbitrary user-defined widgets (including the hooks).

However, it looks to me as though visual mode could potentially be an
exception to this.  It uses the local map to look up the binding, but
then restores the vicmd map before invoking the widget.  On the one
hand, this means we *could* invoke zle-keymap-select (twice); on the
other hand, it means the mode is NEVER "visual" in any *other* context
where it might matter, except for updating the prompt.

I'm personally not a vim user so I have no idea how this corresponds to
actual vim behavior.  It'd also help to understand how you intend to
make use of the $KEYMAP value.

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