OS X: cycle between windows in visual studio code

Visual Studio-Code

Visual Studio-Code Problem Overview


I'm trying desperately to figure out how to cycle through windows in Visual studio code. In Finder, there is a menu item Cycle Through Windows which I use frequently. However, this seems to be a Finder option. So I looked through the global shortcuts (since the requirement is probably the same for many applications) and assigned the Move focus to next window to shift-cmd-F1. This works in Finder and Text Editor, but not in Visual Studio Code. I checked if the key binding is overridden in VSC but I don't think so.

Has anyone got this figured out and can help me?

edit: just found that this is a global shortcut under System Settings > Keyboard > Shortcuts > Move focus to the next window. Unfortunately, Visual Code doesn't use it.

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

I added the following shortcut to keybindings.json

{
    "key": "alt+tab",
    "command": "workbench.action.quickSwitchWindow"
}

workbench.action.quickSwitchWindow does exactly what I want and it has no default shortcut enabled (on a spanish keyboard at least).

Solution 2 - Visual Studio-Code

So, finally found the solution: Though for some reason the system-wide shortcut for Move focus to next window does not work, there is another shortcut which does: shift+cmd+~ :)

Found it here: https://support.apple.com/en-us/HT201236

Solution 3 - Visual Studio-Code

You can use Switch window from command palette (command: workbench.action.switchWindow). The default shortcut is Ctrl + w.

It lists all the open windows for you to select and go.

It's improved further.

Solution 4 - Visual Studio-Code

command ⌘ + ` is working nicely for me on macbook Pro.

Solution 5 - Visual Studio-Code

shift ⇧ + command ⌘ + ~ works for me unless I am in full screen mode. Alternatively, you can use the following shortcuts in full screen:

shift ⇧ + command ⌘ + p then type "Switch Window".

Solution 6 - Visual Studio-Code

The newest version of Visual Code (1.55.2) has window switching enabled by default. The hot key is Control+W (⌃+W), which will bring down a command window for you to select which window to jump to.

Solution 7 - Visual Studio-Code

There seem to be tons of ways to cycle windows. I finally found one that worked for me:

shift + cmd + "{" or "}"

If you go to "window" in the application you'll see menu items for "Next Document" and "Previous Document".

Solution 8 - Visual Studio-Code

Just FYI, the shortcut for Ubuntu(Gnome 3) is alt + ` for switch between visual studio code (or other applications) windows.

Solution 9 - Visual Studio-Code

Set the Quick Switch Window... keyboard shortcut to command+N is a better work around for me.

Go to the menu Code/Preferences/Keybord Shortcuts and search for quickSwitchWindow

Solution 10 - Visual Studio-Code

if you know how to open keybodard shortcuts from vscode, type "switch" in input box which has a placeholder "Type to search in Keybindings". you will see "switch window...".

i am using macbook and ^ + W is an default shortcut key for switching windows in between.

Solution 11 - Visual Studio-Code

To cycle through windows that are in the same desktop, I use :

shift + command + `

Mac OS 12.2. Azerty, and VS Code 1.64.2

Solution 12 - Visual Studio-Code

None of cmd+` cmd+shift+F1 or shift+cmd+~ work for me but ctrl+cmd+\ does.

I'm using a UK Windows keyboard layout - not sure if that affected it..

Edit: I originally found that cmd+\ was working but having restarted VS Code that changed to ctrl+cmd+\ - very odd

Solution 13 - Visual Studio-Code

Personally, I rather use quickOpenRecent instead of quickSwitchWindow because it allows me to quickly switch between the last used window and the current one (stacked cycling instead of sequential). I have the following mapped to alt+tab:

{
  "key": "alt+tab",
  "command": "workbench.action.quickOpenRecent",
  "when": "!inRecentFilesPicker"
},
{
  "key": "alt+tab",
  "command": "workbench.action.quickOpenNavigateNextInRecentFilesPicker",
  "when": "inQuickOpen && inRecentFilesPicker"
},
{
  "key": "shift+alt+tab",
  "command": "workbench.action.quickOpenNavigatePreviousInRecentFilesPicker",
  "when": "inQuickOpen && inRecentFilesPicker"
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionrwengView Question on Stackoverflow
Solution 1 - Visual Studio-CodeDesko27View Answer on Stackoverflow
Solution 2 - Visual Studio-CoderwengView Answer on Stackoverflow
Solution 3 - Visual Studio-CodesiliconsenthilView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeAdam OliverasView Answer on Stackoverflow
Solution 5 - Visual Studio-CodePaymanView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeJ SchmidtView Answer on Stackoverflow
Solution 7 - Visual Studio-CodeAlexus WongView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeDavid MortalsView Answer on Stackoverflow
Solution 9 - Visual Studio-CodeFlorian CallewaertView Answer on Stackoverflow
Solution 10 - Visual Studio-CodeKingJinhoView Answer on Stackoverflow
Solution 11 - Visual Studio-CodeDabruleView Answer on Stackoverflow
Solution 12 - Visual Studio-CodeJayEssView Answer on Stackoverflow
Solution 13 - Visual Studio-CodeFatoreView Answer on Stackoverflow