0

I have this key binding that terminates a running process, what I need is to run another command or a task followed by this one:

{
    "key": "ctrl+b",
    "command": "workbench.action.terminal.sendSequence",
    "args": {"text":"\u0003"},
    "when": "terminalFocus && !terminalTextSelected"
}
1

1 Answer 1

0

You can't do this with the in-built VS Code keybindings functionality.

But you can do it if you use an extension. One such extension is the multi-command extension. It might look something like this:

{
    "key": "ctrl+b",
    "command": "extension.multiCommand.execute",
    "args": {
        "sequence": [
            {
                "command": "workbench.action.terminal.sendSequence",
                "args": { "text": "\u0003" }
            },
            // TODO add your other commands. Ex.
            // "cursorDown"
        ]
    },
    "when": "terminalFocus && !terminalTextSelected"
}

You can for info about how to use the extension here: https://github.com/ryuta46/vscode-multi-command#multi-command-readme. There are some other interesting capabilities of the extension that I won't go into here (because they're not directly relevant).

Not the answer you're looking for? Browse other questions tagged or ask your own question.