Sublime Forum

Remap Ctrl-R to redo in neovintageous after a plugin overrode it

#1

I just started using sublime text. Installed neovintageous and then sublimehaskell. However I can’t use Ctrl-R to redo anymore when editing Haskell files (with other files it is fine). Looks like SublimeHaskell adds these bindings:

    {
        "keys": ["ctrl+r"],
        "context": [
            { "key": "haskell_source" },
            { "key": "scanned_source" } ],
        "command": "sublime_haskell_go_to"
    },

How can I remap Ctrl-R to redo again? And is there any way I can prevent other plugins overriding Ctrl-R or any such keys handled by neovintageous?

0 Likes

#2

as you may know, keybindings are subject to the usual package order of precedence. This means that if multiple packages define a key binding for the same key combination, the contexts of the highest precedence package will be evaluated first to see if they match, before moving on to the next package’s keybindings if they don’t.

In your case, SublimeHaskell comes after NeoVintageous lexographically, so it’s keybindings are evaluated first.

just copy the relevant keybinding from NeoVintageous into your user keybindings.

As mentioned above and in the linked documentation, everything in the User package is evaluated last, to ensure user customizations are always applied/active.

depending how NeoVintageous works, you may want to log an issue on the SublimeHaskell issue tracker to ask them to follow this advice:

Sublime Text provides a command_mode setting to prevent key presses from being sent to the buffer. This is useful, for example, to emulate Vim’s modal behavior.
Key bindings not intended for command mode (generally, all of them) should include a context like this:
{"key": "setting.command_mode", "operand": false}
This way, plugins legitimately using command mode will be able to define appropriate key bindings without interference.

also partially relevant is this feature request, which would allow one to say that certain packages keybindings shouldn’t be honored at all etc.:

2 Likes