randy3k / radian

A 21 century R console
MIT License
1.96k stars 73 forks source link

Allow for ctrl bindings in custom keymap #404

Open fredcallaway opened 1 year ago

fredcallaway commented 1 year ago

Seems arbitrary to only allow escape bindings. I've added the following to load_custom_key_bindings

    keymap = roption("radian.key_map", [])
    for m in keymap:
        print('here we go')
        map_key((m["key"],), m["value"], mode=m["mode"] if "mode" in m else "r")

and then in .radian_profile

options(
    radian.key_map = list(
        list(key = "c-o", value = " %>% ")
    ),
    ...

Happy to make a pull request if you'd like to add this functionality!

randy3k commented 1 year ago

I am open to this idea. Though I prefer having just radian.ctrl_key_map to keep things not too crazy. Otherwise, there may be questions asking, e.g., how to do ctrl+shift+x or ctrl+alt+y which are unfortunately not possible.