microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.71k stars 29.45k forks source link

Bug with switching editor windows #27001

Closed alexreg closed 7 years ago

alexreg commented 7 years ago

Steps to Reproduce:

  1. Close all editor windows.
  2. Open a file in the editor.
  3. Open the Welcome window.
  4. Go to the first file editor.
  5. Press ⌘2.
  6. Observe that screen splits, where the first file opens in a new pane on the right. This should not happen.
Tyriar commented 7 years ago

@alexreg do you want the file created in the second step to only be in the right after you ⌘2 and have the welcome page only on the left?

alexreg commented 7 years ago

No, I expect that ⌘2 would simply bring up the 'Welcome' tab to focus, not split the pane, and open a 2nd version of the file.

Tyriar commented 7 years ago

Ah, the default keybindings use ⌘1, ⌘2 and ⌘3 to focus the first, second and third "editor groups" (aka splits). To get the behavior you're after you need to add the following keybindings to your keybindings.json file:

{ "key": "cmd+1", "command": "workbench.action.openEditorAtIndex1" },
{ "key": "cmd+2", "command": "workbench.action.openEditorAtIndex2" },
{ "key": "cmd+3", "command": "workbench.action.openEditorAtIndex3" },
// etc...
alexreg commented 7 years ago

Oh. This doesn't seem to be what the documentation is suggesting, hmm. Are there any other existing shortcuts that do what I want?

Thanks for the tip anyway.

Tyriar commented 7 years ago

If there's documentation that gives you the wrong idea please link it and we'll clarify it 😃

If you want ⌘2 specifically keybound you will need to change the keybindings.json file manually, those are the commands that will do the job.

alexreg commented 7 years ago

If there's documentation that gives you the wrong idea please link it and we'll clarify it 😃

https://code.visualstudio.com/docs/getstarted/userinterface

When you have more than one editor open you can switch between them quickly by holding the Ctrl (Mac: 'Cmd') key and pressing 1, 2, or 3.

Definitely misleading, if not outright wrong!

Tyriar commented 7 years ago

When you have more than one editor open you can switch between them quickly by holding the Ctrl (Mac: 'Cmd') key and pressing 1, 2, or 3.

@bpasero do you think changing it to "editor group" would be better?

alexreg commented 7 years ago

Also, why do Cmd+1 and Cmd+2 work, but not Cmd+3?

Tyriar commented 7 years ago

@alexreg you need a second editor group visible in order to create a third one.

alexreg commented 7 years ago

Ah, of course. I thought I already tried that, but it seems I hit the wrong button. And there are only 3 editor groups max, I suppose?

Tyriar commented 7 years ago

Yes there's a maximum of 3.