The Computer Oracle

Visual Studio: set focus to text editor

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Puzzle3

--

Chapters
00:00 Visual Studio: Set Focus To Text Editor
00:57 Answer 1 Score 12
01:12 Accepted Answer Score 12
01:43 Answer 3 Score 6
02:10 Answer 4 Score 3
03:05 Answer 5 Score 1
03:22 Thank you

--

Full question
https://superuser.com/questions/1365162/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#keyboardshortcuts #visualstudio

#avk47



ANSWER 1

Score 12


You can simply do it by hitting one of the following

  • Ctrl + Tab
  • Ctrl + F6



ACCEPTED ANSWER

Score 12


In VS2022 I think it's set to Esc by default.

The keyboard command is Window.ActivateDocumentWindow, which can be found here if you wanted to assign it to a different keyboard shortcut:

Tools > Options > Environment > Keyboard > Window.ActivateDocumentWindow




ANSWER 3

Score 6


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",
 ]



ANSWER 4

Score 3


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.




ANSWER 5

Score 1


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