Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio code go to a tab by number

In chrome and most other browsers/editors, we can go to a particular tab by pressing the Command key and the number. For example: If we press Command+1 we will go to the first tab, Command+2 takes to the second tab, etc.

Is it possible to get such a key mapping for Visual studio code ?

like image 491
Sankar Avatar asked Jan 31 '17 06:01

Sankar


2 Answers

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"
  },
like image 152
joepio Avatar answered Nov 09 '22 22:11

joepio


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

like image 41
Sankar Avatar answered Nov 09 '22 21:11

Sankar