Scott on Writing

Musings on technical writing...

Visual Studio Keyboard Shortcut Tip: Ctrl+-

I learned this Visual Studio keyboard shortcut from a client a couple of months ago. I use it several times a day now.

Typing the Ctrl key and - (the minus key) returns you to the previous cursor location, be it in the same file or in a different, open file.

Visual Studio maintains your position in a file as a stack. So as you do a Find and jump to a particular location in a file, or right-click on a method or property name and choose “Go To Definition” Visual Studio keeps track of your position prior to these jumps. You can then 'pop' the position off the stack and return to it by hitting Ctrl+-.

This keyboard shortcut is quite useful when you're bug hunting or trying to understand how some bit of code is working and are drilling down into methods and search results. When you are ready to return to the previous location, which could be in another file or elsewhere in the currently opened file, just hit Ctrl+- to get back! And if you need to get back to the spot before that, hit Ctrl+- again.

posted on Monday, November 24, 2008 10:17 AM

Feedback

# re: Visual Studio Keyboard Shortcut Tip: Ctrl+- 11/24/2008 11:55 AM labilbe

I personnally mapped this useful shortcut to my "back" mouse button, I feel natural to navigate this way like in the browser.

# re: Visual Studio Keyboard Shortcut Tip: Ctrl+- 11/24/2008 1:23 PM Nis L. Simonsen

Very nice :)
Out of curiosity, I tried fooling around with crtl++ (CTRL and +). It seems to select any text between where you are now, and were you were before - anyone with an explanation of that one?

# re: Visual Studio Keyboard Shortcut Tip: Ctrl+- 11/24/2008 2:21 PM Nuno Agapito

Next time, try ctrl+shif+v

VS also uses a stack to store the content for the clipboard, so you can always go back to the previous content on the clipboard.

It changed my life!

# re: Visual Studio Keyboard Shortcut Tip: Ctrl+- 11/25/2008 7:37 AM Dave

You can also use Ctrl+Shift+- to go forward.

# Visual Studio Keyboard Shortcut Tip 11/25/2008 8:32 AM DotNetKicks.com

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# re: Visual Studio Keyboard Shortcut Tip: Ctrl+- 11/26/2008 10:56 AM Adam

If you have your VS.NET settings as "C# Developer", there's a little navigate forward/backward button that does the same thing.

# Best new VS Tip - Ctrl +- 11/27/2008 3:46 AM Grounded in Mobility

Just picked this up from Scott on Writing . Ctrl +- allows you to navigate through the stack of cursor

# re: Visual Studio Keyboard Shortcut Tip: Ctrl+- 11/27/2008 7:49 AM aj

known this shortcut for ages :p useful one and yes the ctrl + shift + v (i miss the copy/paste toolbar in vs2003. it was very useful)

# Interesting Finds: 2008.11.31 11/30/2008 8:22 PM gOODiDEA.NET

.NET Visual Studio Keyboard Shortcut Tip: Ctrl+- / Ctrl+Shift+- Did you know… There’s a way

# Interesting Finds: 2008.11.31 11/30/2008 8:23 PM gOODiDEA

.NETVisualStudioKeyboardShortcutTip:Ctrl -/Ctrl Shift -Didyouknow

# Everyman Links for December 4, 2008 12/4/2008 1:50 PM Dave Burke

Everyman Links for December 4, 2008

# re: Visual Studio Keyboard Shortcut Tip: Ctrl+- 12/10/2008 1:11 AM Aaron Seet

I use [F12] to goto definitions; hardly use the right-click context menu anymore.

Title:  
Name:  
Url:
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments   

My Links

Ads Via DevMavens

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<March 2010>
SMTWTFS
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Comment Stats

DayTotal% of Total
Sunday 2056.8%
Monday 42514.1%
Tuesday 51917.2%
Wednesday 55518.4%
Thursday 58019.2%
Friday 54718.1%
Saturday 1886.2%
Total 3019100.0%

Hour1Total% of Total
12:00 AM 782.6%
1:00 AM 812.7%
2:00 AM 682.3%
3:00 AM 822.7%
4:00 AM 692.3%
5:00 AM 1264.2%
6:00 AM 1183.9%
7:00 AM 1816.0%
8:00 AM 1926.4%
9:00 AM 1585.2%
10:00 AM 1886.2%
11:00 AM 1936.4%
12:00 PM 2016.7%
1:00 PM 1846.1%
2:00 PM 1695.6%
3:00 PM 1354.5%
4:00 PM 1153.8%
5:00 PM 1073.5%
6:00 PM 1013.3%
7:00 PM 1073.5%
8:00 PM 923.0%
9:00 PM 882.9%
10:00 PM 913.0%
11:00 PM 953.1%
Total 3019100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 4.97159
Monday 4.80384
Tuesday 4.04477
Wednesday 7.39680
Thursday 6.26676
Friday 5.07466
Saturday 4.78177
Total 5.403019

Hour1 Entry MadeAvg.Total
12:00 AM 5.2937
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 3.8550
8:00 AM 3.72134
9:00 AM 6.06297
10:00 AM 5.63276
11:00 AM 4.22194
12:00 PM 6.16351
1:00 PM 3.09133
2:00 PM 4.89230
3:00 PM 7.64321
4:00 PM 4.00108
5:00 PM 6.07170
6:00 PM 4.64116
7:00 PM 8.95188
8:00 PM 8.63164
9:00 PM 5.00115
10:00 PM 6.31101
11:00 PM 4.5732
Total 5.403019

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles