Answer a question

In Visual Studio Code, is there a keyboard shortcut to navigate (move cursor) to the last edited position (like in all Jetbrains products with Ctrl+Shift+Backspace)?

The CTRL+- shortcut moves to the last position (not the last edited position), which is less useful for me.

i am using with Visual Studio Code JetBrains IDE Keymap for Visual Studio Code:

Visual Studio Code Version 1.23.1 Commit d0182c3417d225529c6d5ad24b7572815d0de9ac Datum 2018-05-10T17:11:17.614Z Shell 1.7.12 Renderer 58.0.3029.110 Node 7.9.0 Architektur x64

Answers

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 locations
  • canNavigateForwardInNavigationLocations: Whether it is possible to go forward in navigation locations
  • canNavigateToLastNavigationLocation: Whether it is possible to go to the last navigation location
  • canNavigateBackInEditLocations: Whether it is possible to go back in edit locations
  • canNavigateForwardInEditLocations: Whether it is possible to go forward in edit locations
  • canNavigateToLastEditLocation: 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

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐