Windows Terminal Tab shortcuts don't work, Incorrect Type, Expected Object

Viewed 212

No keyboard shortcut options to jump to profile

When I look at the settings.json file, the keys ctrl+shift+NUMBER are supposed to jump to a certain console profile, but they don't see, to work. Looking at it through Visual Studio Code, the error message is 'Incorrect Type. Expected "object".

Error shown in VS Code

Key bindings in settings.json:

"keybindings": [
    {
        "command": "closePane",
        "keys": [
            "ctrl+shift+w"
        ]
    },
    {
        "command": "copy",
        "keys": [
            "ctrl+shift+c"
        ]
    },
    {
        "command": "duplicateTab",
        "keys": [
            "ctrl+shift+d"
        ]
    },
    {
        "command": "newTab",
        "keys": [
            "ctrl+shift+t"
        ]
    },
    {
        "command": "newTabProfile0",
        "keys": [
            "ctrl+shift+1"
        ]
    },
    {
        "command": "newTabProfile1",
        "keys": [
            "ctrl+shift+2"
        ]
    },
    {
        "command": "newTabProfile2",
        "keys": [
            "ctrl+shift+3"
        ]
    },
    {
        "command": "newTabProfile3",
        "keys": [
            "ctrl+shift+4"
        ]
    },
    {
        "command": "newTabProfile4",
        "keys": [
            "ctrl+shift+5"
        ]
    },
    {
        "command": "newTabProfile5",
        "keys": [
            "ctrl+shift+6"
        ]
    },
    {
        "command": "newTabProfile6",
        "keys": [
            "ctrl+shift+7"
        ]
    },
    {
        "command": "newTabProfile7",
        "keys": [
            "ctrl+shift+8"
        ]
    },
    {
        "command": "newTabProfile8",
        "keys": [
            "ctrl+shift+9"
        ]
    },

Is there an issue with the way my settings.json file is structured?

Thanks

1 Answers

You need to structure your keybindings to open a new tab using the command structure:

{ "action": "newTab", "index": 0 }

The profiles are just an array and are accessed for keybindings by their index rather than their name. So you can access the first 9 profiles to open in a new tab like this:

{ "command": { "action": "newTab", "index": 0 }, "keys": "ctrl+shift+1" },
{ "command": { "action": "newTab", "index": 1 }, "keys": "ctrl+shift+2" },
{ "command": { "action": "newTab", "index": 2 }, "keys": "ctrl+shift+3" },
{ "command": { "action": "newTab", "index": 3 }, "keys": "ctrl+shift+4" },
{ "command": { "action": "newTab", "index": 4 }, "keys": "ctrl+shift+5" },
{ "command": { "action": "newTab", "index": 5 }, "keys": "ctrl+shift+6" },
{ "command": { "action": "newTab", "index": 6 }, "keys": "ctrl+shift+7" },
{ "command": { "action": "newTab", "index": 7 }, "keys": "ctrl+shift+8" },
{ "command": { "action": "newTab", "index": 8 }, "keys": "ctrl+shift+9" }
Related