2

When we right click and select Go to definition in VSCode, it opens the new file in place of the current. How do we navigate back to where we came from?

Ole
  • 41,793
  • 59
  • 191
  • 359
  • it is possibly a duplicate: https://stackoverflow.com/questions/35424367/how-to-navigate-back-to-the-last-cursor-position-in-visual-studio-code – mpakbaz Nov 18 '18 at 22:29

2 Answers2

3

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

Axifive
  • 1,159
  • 2
  • 19
  • 31
Peter
  • 119
  • 12
1

On Windows, it's Alt+LeftArrow, just like navigating backwards in a web browser.

asherber
  • 2,508
  • 1
  • 15
  • 12
  • 1
    Hmmm - That's the first thing I tried and it does not work on Ubuntu ... – Ole Nov 18 '18 at 22:37
  • Ah, I didn't realize what OS you were on. Take a look here: https://stackoverflow.com/a/35433087/226781 – asherber Nov 19 '18 at 13:15
  • Also, in VS Code, take a look at File -> Preferences -> Keyboard Shortcuts. You can search there by command name (and also by key name, like LeftArrow, which is handy). – asherber Nov 19 '18 at 13:18