VSCode by default binds cmd+p
to workbench.action.quickOpen
. Which is fine. My only issue is that when you confirm a quickOpen
on a file using enter
it opens the file in a “preview” mode (indicated by the tab’s name having an italic font). This “preview” mode means that if I open two files in a row using cmd+p
the action of opening the second will take over the “preview” slot, effectively closing the first file's preview.
VSCode has a setting called workbench.editor.enablePreviewFromQuickOpen
which you can use to change this behavior globally. But I don’t want to change it globally. You can also manually move a file out preview mode using workbench.action.keepEditor
which is bound by default to cmd+k+enter
. But that's an obnoxious extra step.
I would like to selectively decide when I want to open in “preview” mode or in “edit” mode. Ideally I would like to bind something like shift+enter
to do this. In my keybindings.json
have tried variations on
{
"key": "shift+enter",
"command": "workbench.action.keepEditor",
"when": "inFilesPicker && inQuickOpen"
}
but with no luck :(
The answer to this question ALMOST does what I want: vscode: Open file instead of previewing file from quick open
The proposed solution of using alt+enter
opens the file in a new window. No bueno.
The proposed solution of using the right arrow key to open the file does work... but it does not close the Command Palette like hitting enter does. No bueno.