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

前端 未结 10 2019
梦如初夏
梦如初夏 2020-11-30 15:50

What is the keyboard shortcut navigate back to the last cursor position in Visual Studio Code?

相关标签:
10条回答
  • 2020-11-30 16:44

    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?

    0 讨论(0)
  • 2020-11-30 16:44

    With VSCode 1.43 (Q1 2020), those Alt+ / Alt+, or Ctrl+- / Ctrl+Shift+- will also... preserve selection.

    See issue 89699:

    Benjamin Pasero (bpasero) adds:

    going back/forward restores selections as they were.

    Note that in order to get a history entry there needs to be at least 10 lines between the positions to consider the entry as new entry.

    0 讨论(0)
  • 2020-11-30 16:48

    +U Undo last cursor operation

    You can also try ctrl+-

    BTW all the shortcuts is here https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf This is really useful!

    0 讨论(0)
  • 2020-11-30 16:53

    Mac OS (MacBook Pro):

    Back: CTRL(control) + - (Hyphen)

    Back Forward: CTRL + Shift + - (Hyphen)

    0 讨论(0)
提交回复
热议问题