Sublime Forum

ST4: How to disable Ctrl+Enter in "go to file" overlay (Ctrl+P)

#1

In ST3, the sequence

  1. Press Ctrl+P
  2. Release P, but not Ctrl
  3. Press Enter, effectively pressing Ctrl+Enter

toggles between the two most recently viewed files.

In ST4, the same sequence opens a new view into the last viewed file (new tab multi-select feature):

Goto Anything allows opening tabs side-by-side using ctrl/cmd

My muscle memory won’t let me release that Ctrl key before I press Enter. :worried:

Is there any way to disable Ctrl+Enter in this specific context? I can’t find that key binding in Default (Linux).sublime-keymap.

0 Likes

#2

There’s not a direct binding for it; commands can now fetch the state of the modifier keys as they existed when the command was invoked so that they can take extra actions like this.

Try adding this key to your bindings:

    { "keys": ["ctrl+enter"], "command": "select", "context":
        [
            { "key": "overlay_has_focus", "operator": "equal", "operand": true },
            { "key": "overlay_name", "operator": "equal", "operand" : "goto" }
        ],
    },

This is what the default binding for enter does, but here we map ctrl+enter directly to the select command, which at least on my Linux machine here overrides the commands ability to look up the modifier so that it behaves the same as it did previously.

0 Likes

#3

And as expected it also works for me. Thank you!

0 Likes