Jumping to files in Visual Studio Code (and keeping them open)

One of the most important shortcuts in any text editor, the good ‘ol jump to file shortcut.

In Visual Studio Code (on macOS), this shortcut is ⌘+P. It mostly works like expected, you just start typing a file’s name, and select it when you see it.

But I noticed that Visual Studio Code had this weird quirk. When I open another file, by either tabbing away, clicking on one in the file explorer view, or doing another ⌘+P , the file isn’t open anymore and I have to open it again.

Turns out this is because it opens the file you jumped to in a preview mode, which means that the tab auto closes when you go away from it.

Now, I don’t know about you, but when I navigate to a file, and see it listed in the tabs, I would like that file to stay open until I close it. While the title of the tab in preview mode looks slightly different, it’s something that took me a while to notice. I kept thinking that I closed the tab by mistake when I noticed that it disappeared.

Luckily, this option, like almost anything else, is configurable in Visual Studio Code. All you need to do is open up the configuration, with the shortcut of ⌘+P on macOS, and add/change this option:

“workbench.editor.enablePreview”: false,

Now when you jump to a file, or even click on it in the explorer view (without double-clicking it), it’ll keep it open!