'Switch cursor from editor to file explorer and vice versa in VS code
Is there a shortcut to switch from editor to file explorer (and vice versa) on vscode ? I have yet to find one. Thanks you for your help.
Solution 1:[1]
Please try the View: Show Explorer
shortcut key, ctrl+shift+e.
Solution 2:[2]
For macOS, use shift
+cmd
+E
. Note that if the hotkey is also occupied by another program on your mac, you may need to disable it in the preferences of the program before it tasks effect in VSCode.
Solution 3:[3]
Unfortunately Ctrl
+ Shift
+ e
doesn't do the trick for me, as I utilize various vim setups within vscode. This makes working around Ctrl
keys often complex.
I can confirm that @MohamedNaleem's answer works when I turn off various vim integrations. If you don't use vim, I suggest sticking with the built-in.
My solution Focus & Visibility
I use the chord Ctrl
+Space
e
to switch between the explorer and open editors. It feels nice and ergonomic to me -- all I do is hit the Ctrl
and Space
keys together and the e
key quickly afterwards.
Notice the intentionally missing
+
betweenSpace
ande
when notating the chord.
? What to change in Keyboard Shortcuts ?
The commands you're looking for are
Explorer: Focus on Folders View
, andView: Toggle Side Bar Visibility
.
To change them simply bring up your command pallet (type Ctrl
+ Shift
+ P
), type keyboard
, select Preferences: Open Keyboard Shortcuts
, and input the two shortcut commands above to search.
Double click to select and type your new Ctrl
+ Space
e
chord. Enter
or Return
to confirm. Voila!
Solution 4:[4]
Focus the file explorer
ctrl+shift+e
focuses the file explorer on Windows, and I think cmd+shift+e
focuses the file explorer on on MacOS; but in Ubuntu (at least), ctrl+shift+e
in an editor is the emoji shortcut, which is why I added this chord:
{
"key": "ctrl+alt+r",
"command": "revealFileInOS",
"when": "!editorFocus"
}
The command revealFileInOS
focuses the file explorer at the current file.
To add or change a keyboard shortcut, press ctrl+k
, then ctrl+s
(on Linux or Windows).
Focus an editor
To focus an editor pane, use ctrl+N
on Linux or Windows, cmd+N
on a Mac), where N is the pane number starting at 1.
Most commonly, you'll have a single pane, so it would be ctrl+1
on Linux or Windows, cmd+1
on a Mac.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Brian Tompsett - æ±¤èŽ±æ© |
Solution 2 | yuansi zhu |
Solution 3 | |
Solution 4 |