I am creating a major mode, and would like to have modal interface (such as vi) on it.
I want to have a special key that toggles the behaviour on arrow keys.
So, for example, if the special key is hit, arrows move the char underneath.
And when the special key is hit again, arrows behave as normally.
How can I implement such thing?
I suspect it could work creating two different keymaps for the mode.
And then switching from one to the other after the special key press. But not really sure if that would be the way to do it.
And honestly, I do not really know how to make that special key, so it can rebind other keys on the fly.
Hmmm... I should probably look for the code of a mode that implements a modal interface...