Sublime Forum

Bind ctrl+[ to "return to normal mode" AND close any dropdowns, suggestions etc in vintage mode

#1

I’ve run into this annoying issue where when I return to normal mode from command mode in vintage mode sometimes a suggestion box is left open or instead of going back to command mode I actually just left a deeper mode (like “tab through template/snipped” mode) and my workflow is disrupted because I’m not in the mode I expect or an input gets eaten before doing what I want. I’ve bound ctrl+[ to “return to normal mode” in the key bindings, but this still leaves suggestions open and interferes with navigation. When I hit ctrl+[, I want to return to a clean normal mode. All dialogues should be closed and there should be no question about what mode I’m in, normal mode should operate normally (ha) from the first key I press after ‘[’. How do I do this?

0 Likes

#2

You can install Chain of Command and just call all hide commands in one keybinding:

    {
        "keys": ["ctrl+["],
        "command": "chain",
        "args": {
            "commands": [
                ["single_selection"],
                ["clear_fields"],
                ["hide_panel"],
                ["hide_overlay"],
                ["hide_popup"],
                ["hide_auto_complete"],
                ["exit_insert_mode"]
            ]
        },
        "context":
        [
            { "key": "setting.command_mode", "operand": false },
        ],
    },

I don’t think there is a problem to call any of the hide command if the corresponding popup is not visible.

0 Likes