Rickety
Rickety

Reputation: 834

VS Code - Possible to switch tabs/files with cmd+numbers?

I started using Visual Studio Code today (I've been using Atom and Sublime for years).

In Atom/Sublime (and Chrome, Firefox, etc...) you can go to another open tab with CMD + a number. Is it possible to get that behavior in VSC? (Mac)

Right now "CMD + 2" just splits the file in two columns and I do not need that at all.

Upvotes: 76

Views: 10991

Answers (3)

Jeffrey
Jeffrey

Reputation: 103

My current config for choosing tab in mac VS Code:

[
  {
    "key": "cmd+[",
    "command": "workbench.action.previousEditor"
  },
  {
    "key": "cmd+]",
    "command": "workbench.action.nextEditor"
  },
  {
    "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"
  },
  {
    "key": "cmd+0",
    "command": "workbench.action.lastEditorInGroup"
  }
]

Upvotes: 3

Mr EdHeltzel
Mr EdHeltzel

Reputation: 1839

Yeah this is possible.

File -> Preferences -> Keyboard Shortcuts -> Click keybindings.json (document icon with an rounded arrow coming out of the left side)

{ "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" }

Upvotes: 148

Rickety
Rickety

Reputation: 834

The answer from Ginfuru above still works fine, but if you want more things in VSC to behave like Atom, I can also recommend this extension: Atom Keymap, that ports popular Atom keyboard shortcuts to VSC.

Upvotes: 7

Related Questions