In VS Code (Visual Studio Code), you can quickly and conveniently move your mouse cursor to the last edit location by using the following shortcuts:
- Mac:
- Jump back: Ctrl + – (the minus key on your keyboard)
- Jump forward: Ctrl + Shift + –
- Windows:
- Navigate back: Alt + Left Arrow key
- Navigate forward: Alt + Right Arrow key
Demo:
Note: If you’re using Safari, this demo video might not work nicely or not start at all. Please use Chrome, Edge, Firefox, or another web browser instead.
You can see exactly the shortcuts that match your operating system by heading to the top bar of VS Code and opening the Go menu (the first three rows):
Note: At the time of writing, VS Code only remembers the last and the current cursor position
Further reading:
- VS Code: Hide/Show the Debug button in package.json
- VS Code: How to Open File in New Tab (Keep the Current File)
- 2 ways to check your VS Code version
- How to Change File Encoding in VS Code
- VS Code: Opening Multiple Windows/Projects Simultaneously
- VS Code: Hide Specific Files/Folders from the Left SIdebar
You can also check out our Visual Studio Code topic page for more tips and tricks to improve your producibility and coding experience.