visual studio code go to a tab by number

Since VSCode uses ctrl+number by default (which changes desktops in macOS), you can use cmd+number with custom keybindings:

Paste this in your keybindings.user:

  {
    "key": "cmd+1",
    "command": "workbench.action.openEditorAtIndex1"
  },
  {
    "key": "cmd+2",
    "command": "workbench.action.openEditorAtIndex2"
  },
  {
    "key": "cmd+3",
    "command": "workbench.action.openEditorAtIndex3"
  },
  {
    "key": "cmd+4",
    "command": "workbench.action.openEditorAtIndex4"
  },
  {
    "key": "cmd+5",
    "command": "workbench.action.openEditorAtIndex5"
  },
  {
    "key": "cmd+6",
    "command": "workbench.action.openEditorAtIndex6"
  },
  {
    "key": "cmd+7",
    "command": "workbench.action.openEditorAtIndex7"
  },
  {
    "key": "cmd+8",
    "command": "workbench.action.openEditorAtIndex8"
  },
  {
    "key": "cmd+9",
    "command": "workbench.action.openEditorAtIndex9"
  },

This is available now, with the latest version of Visual Studio Code. See: https://github.com/Microsoft/vscode/issues/24753#issuecomment-294518439


On macOS, the shortcuts default to ctrl + n, not cmd + n. You can fix that in Code -> Preferences -> Keyboard Shortcuts. Another note: most other apps activate the last tab with cmd+9. I'm not sure whether VSCode can do that easily.