Search code examples
sublimetext3visual-studio-code

VS Code: How to configure Go to File command to auto-select the previous file (like Sublime)


If I trigger the Go to File command in Sublime, don't type anything, and hit enter it auto-selects the previously viewed file:

enter image description here

In VS Code, the Go to File command auto-selects the current file, which means I have to type the file name or hit the down arrows.

enter image description here

What setting do I need to change so that the previously viewed file is auto selected if I trigger the Go to File command?


Solution

  • There is no such setting, but see the same issue: https://github.com/Microsoft/vscode/issues/26977 (Select previous file by default when using Ctrl-P). The solution is to add this to your keybindings.json:

    {
      "key": "ctrl+p",  // or cmd
      "command": "workbench.action.quickOpenPreviousEditor"
    }
    

    Now Ctrl+P will open the file quickopen panel with the previous file selected.

    If you prefer the "Go to File..." keybinding Ctrl+E then you should use that in the above new keybinding instead of Ctrl+P.