Visual Studio: set focus to text editor

Solution 1:

You can simply do it by hitting one of the following

  • Ctrl + Tab
  • Ctrl + F6

Solution 2:

There is no such shortcut for Visual Studio, but you might create one with the help of this AutoHotKey script:

SetTitleMatchMode, 2
#IfWinNotActive, Visual Studio
F4::WinActivate, Visual Studio

I have chosen here the F4 key, but you may choose any other key.

After installing AutoHotKey, put the above text in a .ahk file and double-click it to test. You may stop the script by right-click on the green H icon in the traybar and choosing Exit. To have it run on login, place it in the Startup group.


A solution for returning to the text-editor while Visual Studio has the focus is by using the hotkey Ctrl+Tab.

Solution 3:

I find the the action workbench.action.focusActiveEditorGroup

So bind something with that, like ctrl+q

To make the shortcut work through terminal add it to setting.json

// setting.json

"terminal.integrated.commandsToSkipShell": [
    "workbench.action.focusActiveEditorGroup",
 ]

Solution 4:

Editor management

Ctrl+F4, Ctrl+W Close editor
Ctrl+K F Close folder
Ctrl+\ Split editor
Ctrl+ 1 / 2 / 3 Focus into 1st, 2nd or 3rd editor group
Ctrl+K Ctrl+ ←/→ Focus into previous/next editor group
Ctrl+Shift+PgUp / PgDn Move editor left/right
Ctrl+K ← / → Move active editor group

From https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf

And for other Operating Systems - https://code.visualstudio.com/docs/getstarted/keybindings