James
James

Reputation: 2911

F12 Jump to method -> go back to previous method after making the jump?

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?

Upvotes: 150

Views: 78445

Answers (6)

Smart Coder
Smart Coder

Reputation: 1738

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

Upvotes: 1

Khaino
Khaino

Reputation: 4149

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

Upvotes: 2

David
David

Reputation: 585

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.

Upvotes: 4

Wolfram
Wolfram

Reputation: 502

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...)

Upvotes: 16

BClaydon
BClaydon

Reputation: 1970

@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

Upvotes: 25

Oded
Oded

Reputation: 498972

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

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

Upvotes: 235

Related Questions