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 24,  4:59pm, Hugh X wrote:
}
} Got it. Thanks for the explanation. My preliminary thought is to use
} the "visual" to update the prompt so that I can add/debug some key
} bindings in the visual mode.

OK, that's the one context where it's potentially useful, but:

} Since you mentioned that these local keymaps will have their own
} widget-binding methods through the interpreter, I wound whether there
} is such special widgets that similar to *_init and *_exit.

In fact visual mode is the one case where there is NOT any such local
interpreter -- there's just a different keymap, which is still handled
by the global interpreter.  This is why it would not break anything to
invoke the zle-keymap-select hook.

However, there's also no clear begin/end of visual mode.  As presently
implemented, visual mode is a combination of a couple of different
states that can each be changed independently; the determination of
whether this "mode" is in effect is not made until the last instant
before ZLE waits for the next keystroke, and is forgotten as soon as
the keystroke has been consumed.  The keymap isn't even in place long
enough for the corresponding widget to see it; it's indistinguishable
from vicmd mode.

Consequently the zle-keymap-select hook would be called twice on every
keystroke during visual "mode", if naive implementation were adopted.



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