I jumped to a line in a code file in Visual Studio using "Go to definition". I am now lost in the file and I want to go back to the line I was at before. How do I do it?
6 Answers
You can hit Ctrl+- I believe. Also, Ctrl+Shift+- navigates forward.
Depending on your mouse software, you should be able to map those keyboard shortcuts to your mouse's back/forward buttons. You can typically do this with gaming mice, and there's probably third-party gaming software that lets you do it also. Mapping "Find all references" to a button is great too.

- 583
- 7
- 13

- 13,499
- 16
- 80
- 133
-
Any plugin/app that changes mouse behavior per application? I'd love to map the "navigate back" button on my mouse to this keyboard shortcut in VS. It works natively in VS 2010 but no love for VS 2008. – Cᴏʀʏ Jun 21 '12 at 20:30
-
2If you have a Microsoft mouse, IntelliPoint should do the trick. If you have a Logitech mouse, you can try SetPoint. – Jon Onstott Jun 22 '12 at 16:34
-
I know I can change the mappings of the buttons, but if I change them in SetPoint, they will be global, and I would lose the native behavior of the buttons for navigation in many other applications. – Cᴏʀʏ Jun 22 '12 at 17:37
-
2SetPoint sometimes let you set application-specific button assignments. It depends on the mouse you have I think (which is silly, since they -could- enable it for all mice, if they really wanted to) – Jon Onstott Jun 25 '12 at 01:57
-
1You're a genius. I found buried in the SetPoint software application-specific button assignments. Seems to work so far! – Cᴏʀʏ Jun 25 '12 at 13:26
You can also use you mouse back and forward navigation buttons if you have such a device.
Please note that if you are using a Logitech device you need to launch SetPoint with the same privileges as Visual Studio. In other words, if you launch Visual Studio as admin, you need to launch SetPoint as admin too for the Back and Forward to work properly.

- 56
- 3
I realize this is an old thread, but since it was the first link I came across from a Google search, I'll mention what I found:
In Visual C# 2010 Express, under Tools -> Settings, there is a "Basic Settings" option and an "Expert Settings" option. (Basic Settings is selected by default.) If you select Expert Settings, the standard toolbar will have back/forward buttons.

- 1,508
- 3
- 18
- 34
In Visual Studio 2019
To change this setting to whatever you want (or see the current mapping), use
Tools->options
search for Keyboard
under Show commands containing:
then search for NavigateBackward
or NavigateForward

- 23,452
- 27
- 113
- 201
-
Once selected, each of these should also show the shortcut key to activate (eg. "ctrl+ -", and "ctrl+shift+ -"). In the list mine showed up as View.NavigateBackward & View.NavigateForward, which also gave me a hint on where to find them in the "File Menus", which then assisted in adding two custom shortcut icons on the toolbar. Although - they might already be part of the "Standard" toolbar. – Jonno Oct 12 '21 at 15:14
By using the Navigate Backwards command. You can find a more detailed description here.

- 56,676
- 12
- 126
- 154
What threw me for a loop is that only the minus on the left side of my keyboard works, not the one on the numpad. This should save me a lot of time. I always wished for this and never thought to search for help on it.
(This is in Visual c# 2010 Express with an older Microsoft ergo keyboard (2000?)

- 1,015
- 12
- 17
-
Thank you for highlighting this. I had given up and was searching for other solutions when I saw your comment tried it out and it worked. I'm using VS2019. – Jonno Oct 12 '21 at 14:48