I have switched focus to the explorer using cmd+shift+E. I have selected a file in the explorer using the arrow keys.
I have found that ctrl+enter opens the file in a new tab.
How do I preview the file?
How do I open the file?
2 Answers
Built-in Command Overview
When working with VSCode on Windows, you can use the following commands to open/preview files from the explorer:
- Give the editor focus with
workbench.files.action.focusOpenEditorsView. Default keybinding: Ctrl + K E - Preview the highlighted file in the explorer with
list.select. Default keybinding: Enter - Preview the highlighted file in the explorer in a new tab with
explorer.openToSide. Default keybinding: Ctrl + Enter - Once the file preview is in focus and you want to open the file so it remains in the editor, use
workbench.action.keepEditor. Default keybinding: Ctrl + K Enter
As of writing this, it seems it is not possible to keybind an action that directly opens the file from the explorer. Fortunately, we can remedy this with the macros extension as seen below.
Note: As for Mac, my understanding is that pressing Enter in the explorer will rename the file. Use the default shortcut Command + Down, or open the keyboard shortcuts menu and map list.select to something you want to use to open the file preview from the explorer. You could also remap renameFile from Enter to something else, and then use Enter for list.select.