VSCode: Open file from file explorer with Enter key on Mac OSX
Solution 1:
If anyone else comes across this problem, the keyboard shortcut to open a file from the file explorer in VSCode on a Mac is:
CMD+Down
This also works in Finder.
Solution 2:
I ended up compiling a few solutions here together to get the following keybinding.json
editions (Open via Code > Preferences > Keyboard Shortcuts > keybindings.json
):
{
"key": "cmd+enter",
"command": "renameFile",
"when": "explorerViewletVisible && filesExplorerFocus"
},
{
"key": "enter",
"command": "-renameFile",
"when": "explorerViewletVisible && filesExplorerFocus"
},
{
"key": "enter",
"command": "list.select",
"when": "listFocus && !inputFocus"
}
Solution 3:
In version 1.19.2, on the mac I was able to go to keyboard shortcuts (menu bar > code > preferences > keyboard shortcuts), search for "rename," and edit "renameFile" ("When" value is "explorerViewletVisible && filesExplorerFocus && !inputFocus") changing the shortcut to "cmd+enter."
You can also past the following in your keybindings.json (there's a link to it on the keyboard shortcuts page):
{
"key": "cmd+enter",
"command": "renameFile",
"when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
}
Enter now opens the highlighted file in the explorer and ctrl+enter puts it in rename/edit mode.
–Edit–
After I upgraded to 1.21.0 the enter key started functioning as renameFile again. cmd+enter still functioned as renameFile as well. To fix this either go to menu bar > code > preferences > keyboard shortcuts and right-click the offending entry and remove it or add a hyphen/minus sign to the beginning of the command in keybindings.json:
{
"key": "enter",
"command": "-renameFile",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
}
Solution 4:
On my Mac, simply hitting the Spacebar opens the file for me.