144

I can jump to code if I click in a method name and hit F12. But, is there a keyboard short cut to jump back to the previous code editor location?

2
  • 3
    In Visual Studio Code You can also choose <Alt> + <Left-Arrow> to return to your original location after navigating using F12.
    – David
    Commented Aug 1, 2018 at 2:53
  • 2
    No. that doesn't work in VS2015. Typical of MS to REMOVE useful and productive features. (It as ALWAYS been Ctrl-* gojng back decades... until those clowns decided to re-write it yet again) Commented Apr 10, 2019 at 13:06

6 Answers 6

228

Ctrl + - : (that's Ctrl and Minus) will navigate back (maps to View.NavigateBackward).

See this list of pre-defined keyboard shortcuts on MSDN.

2
  • 3
    Note: use the minus key with the underscore character. The minus key, on the keypad, may not work for this shortcut. I suppose it depends on the keyboard that you use. Commented Aug 17, 2020 at 13:48
  • The shortcuts for more recent versions of Visual Studio are here Commented Feb 19 at 10:48
24

@Oded is correct, but wait, there's more!

  • If F12 sent you to a new tab window you can Ctrl + Tab to get back to your original tab. If you hold down Ctrl you can cycle through tab windows
  • In VS 2010 you can Ctrl + Click to Go To Definition, in addition to F12.
  • You can also hold down Ctrl and move your mouse over identifiers to highlight which ones you can jump to
2
  • For F12, MSVS 2010 opens a new tab. For MSVS 2013 it replaces current tab. I'm not seeing anywhere to configure this behavior.
    – crokusek
    Commented Feb 24, 2015 at 19:47
  • To Prevent Closing Link
    – crokusek
    Commented Feb 27, 2015 at 0:47
15

While Ctrl- and CtrlShift- are indeed the shortcuts to navigate to the previous/next cursor position, in this particular case (i.e., going back after F12 or similar) this shortcut might be more useful:

CtrlShift8 (=View.PopBrowseContext)

It will jump back to the place where you pressed F12, ignoring any cursor locations after you pressed F12.

(NOTE: currently using VS 2013, and hoping this shortcut entry also exists in VS 2010...)

3
4

In Visual Studio Code, you can also use Alt + Left-Arrow to return to your original location in the source code after navigating with F12.

2

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

Source

1
  • These are for Visual Studio Code. for Visual studio, see the accepted answer. Commented Jan 12, 2023 at 8:55
1

On the top menu bar, right click and it'll give you an option -> 'command center'. See the arrow after you select it.

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.