Search code examples
visual-studio-codekeyboard-shortcuts

VS Code return to the last cursor position from search all side-bar


in VS code you can normally use alt+left to go back to the last cursor position when your cursor is currently on an opened document. however, if you will press ctrl+shift+f (find in all) the cursor will jump to the find in all search side-bar, and to return to the last position in the document you have to use your cursor (crtl+left won't work).

is there a way to move back from the search results side-bar to the last position in the document in VS code? (in Jetbrains products, for example, esc will do the trick because the search results are actually in a modal)


Solution

  • The command workbench.action.focusActiveEditorGroup will do what you want. So you could set up a keybinding like this (in keybindings.json):

    {
      "key": "alt+left",
      "command": "workbench.action.focusActiveEditorGroup",
      "when": "searchViewletFocus"        // probably not necessary, but safer
    }
    

    See customizing keybindings to learn how to access the keybindings.json file.