fide/DESIGN.org

972 B

Keymapping system

Keymap Stacking

There shouldn't be modes, there would be keymaps and a stack. Insert mode would be at the bottom of the stack. Adding a new mode means pushing onto the stack, and when a keybinding event is raised, you iterate over the stack from top to bottom to find the correct keybinding. The vim nomenclature wouldn't work in this case as you don't "leave insert mode". Rather, you pop the "normal mode" keymap ontop of the "insert mode" keymap.

Passthrough/Blocking

The keymap object should have additional settings that dictate its behavior when a key is found and not found.

Found

Pop

The default could be to pop from the stack.

Keep

Keep the keymap on the stack. This is useful for both normal mode and transient like modes where you need to explicitly pop it from the stack.

Not found

Passthrough

Allow the loop to go to the next keymap

Block

Ignore missing key, don't pop the keymap, maybe report an error