How to navigate back to the last cursor position in Visual Studio Code?

The Keyboard Shortcut Commands are Go Forward and Go Back.


On Windows:

Alt+ .. navigate back

Alt+ .. navigate forward

On Mac:

Ctrl+- .. navigate back

Ctrl+Shift+- .. navigate forward

On Ubuntu Linux:

Ctrl+Alt+- .. navigate back

Ctrl+Shift+- .. navigate forward


I am on Mac OSX, so I can't answer for windows users:

I added a custom keymap entry and set it to Ctrl+ + Ctrl+, while the original default is Ctrl+- and Ctrl+Shift+- (which translates to Ctrl+ß and Ctrl+Shift+ß on my german keyboard).

One can simply modify it in the user keymap settings:

{ "key": "ctrl+left",  "command": "workbench.action.navigateBack" },
{ "key": "ctrl+right", "command": "workbench.action.navigateForward" }

For the accepted answer I actually wonder :) Alt+ / Alt+ jumps wordwise for me (which is kinda standard in all editors). Did they really do this mapping for the windows version?


This will be different for each OS, based on the information at https://code.visualstudio.com/docs/customization/keybindings

Go Back: workbench.action.navigateBack Go Forward: workbench.action.navigateForward

Linux Go Back: Ctrl+Alt+-
Go Forward: Ctrl+Shift+-

OSX ⌃- / ⌃⇧-

Windows Alt+ /