Kungsgeten / ryo-modal

Roll your own modal mode
MIT License
222 stars 14 forks source link

Define major mode keys for parent modes #29

Closed jmorag closed 4 years ago

jmorag commented 4 years ago

Is it possible to define major mode keys in parent modes? For example, I'd like to have 'w' as forward-word in non-programming modes, but forward-same-syntax in programming modes, but the following doesn't seem to do that.

(ryo-modal-keys
  ("w" forward-word))

(ryo-modal-major-mode-keys 'prog-mode
  ("w" forward-same-syntax))
Kungsgeten commented 4 years ago

Hi! No, at the moment that's not possible. The way the major-mode specific bindings work is that RYO looks for a keymap named after the current major-mode. So if you're in c-mode it would look for ryo-c-mode-map.

I agree though that it would be nice if it would work for derived modes. I have some ideas, maybe I can make it work :)

Kungsgeten commented 4 years ago

It wasn't that hard! It should work now with the latest commit.

jmorag commented 4 years ago

Excellent! Thank you very much :)