keyboard shortcut for go back to last edited position in Visual Studio Code
Last Edited Shortcut
Cntrl+k,Cntrl+q
Last Cursor Movement
ALt+Arrow left
Also see https://stackoverflow.com/a/71212026/836330 for new navigation commands in vscode v1.65. See that link for navigating to next/previous cursor locations (where the cursor was but maybe no actual edit there).
For last edited locations:
Go Forward in Edit Locations
"workbench.action.navigateForwardInEditLocations"
Go Back in Edit Locations
"workbench.action.navigateBackInEditLocations"
Go Previous in Edit Locations
"workbench.action.navigatePreviousInEditLocations"
Go to Last Edit Location
// acts like a toggle between current and last edit location
"workbench.action.navigateToLastEditLocation"
Associated context keys have been added to make assigning keybindings more powerful:
canNavigateBackInNavigationLocations
: Whether it is possible to go back in navigation locationscanNavigateForwardInNavigationLocations
: Whether it is possible to go forward in navigation locationscanNavigateToLastNavigationLocation
: Whether it is possible to go to the last navigation locationcanNavigateBackInEditLocations
: Whether it is possible to go back in edit locationscanNavigateForwardInEditLocations
: Whether it is possible to go forward in edit locationscanNavigateToLastEditLocation
: Whether it is possible to go to the last edit location
[EDIT]: v1.28.0 just added a command to go back to the last edited position, see release notes: navigate back to last edited position.
Navigate to last edit location
A new command Go to Last Edit Location (
workbench.action.navigateToLastEditLocation
) was added to quickly navigate to the last location in a file that was edited. The default keybinding is
Ctrl+K Cntrl+Q
For Windows use Alt+RightArrow
and Alt+LeftArrow
.