Open hendursaga opened 1 year ago
I believe a custom nkeymap
translator should be enough to implement it.
@Ambrevar I figured that would be the bulk of it.
Another problem would be keeping it tied to emacs-mode
as well as what to do with passthrough-mode
...
The first observation is that we can't afford to curate every set of keybindings, but we should provide the foundations for users to define they own and maintain external libraries.
Emacs keybindings achieve modality by pre-prending modifier keys, whereas VI keybindings are inherently modal.
god-mode
, in Nyxt's parlance, would be basically a modified VI keyscheme. Am I wrong?
I'd abstract our keyschemes. We have non-modal ones (default
, cua
and emacs
) and one modal (vi
). We should make vi
a particular case of a modal keyscheme, where users could choose the key to set the active mode(s) (insert, command, etc) and choose the keybindings for each mode. The way I see it, god-mode
isn't the best source of inspiration here, but rather ryo-modal.
The first observation is that we can't afford to curate every set of keybindings
I agree, but god-mode
is essentially Emacs keybindings with shortcuts to avoid destroying your pinky finger from trying to reach the physical modifier keys. I haven't really researched ryo-modal
- mostly because I found god-mode
sufficient enough for myself - but looking it over, I would say it would be better inspiration, a more general approach.
Huh, maybe introducing yet another layer of input management below command-dispatcher
and input-skip-dispatcher
could allow this extension? :thinking:
Then the design would be:
key-dispatcher
-- dispatches over the key, allowing to either
key-dispatcher
would call:
comand-dispatcher
for keys that have command keybindings.input-skip-dispatcher
for those that don't have bindings.While describe-key
is an extension on the level of command-dispatcher
, god-mode
would be a key-dispatcher
extension, basically checking every key's prefixed presence in the keymaps and using its prefixed bindings if they are unambiguous.
See 309728fae1252cda9353e6b393f5589239df0fa4 and the commits following it for the origins of the command-dispatcher
and input-skip-dispatcher
.
@aadcg @aartaka I don't believe we need to add anything new: nkeymap
was designed to support this kind of things. Look into the key translators: it's an abstraction layer between the inputted keys and the bindings.
I see...
god-mode is one of my favorite Emacs packages for reducing my risk of getting RSI as well as avoiding evil, and since I use Emacs-style keybindings in Nyxt, it would be nice to port some / all of the functionality over!