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.
<July 2009>
SMTWTFS
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

Comment Stats

DayTotal% of Total
Sunday 2046.9%
Monday 42314.3%
Tuesday 50116.9%
Wednesday 54518.4%
Thursday 57219.3%
Friday 53618.1%
Saturday 1856.2%
Total 2966100.0%

Hour1Total% of Total
12:00 AM 752.5%
1:00 AM 802.7%
2:00 AM 672.3%
3:00 AM 812.7%
4:00 AM 642.2%
5:00 AM 1234.1%
6:00 AM 1153.9%
7:00 AM 1755.9%
8:00 AM 1876.3%
9:00 AM 1565.3%
10:00 AM 1866.3%
11:00 AM 1926.5%
12:00 PM 1996.7%
1:00 PM 1846.2%
2:00 PM 1675.6%
3:00 PM 1344.5%
4:00 PM 1153.9%
5:00 PM 1063.6%
6:00 PM 993.3%
7:00 PM 1063.6%
8:00 PM 903.0%
9:00 PM 842.8%
10:00 PM 893.0%
11:00 PM 923.1%
Total 2966100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 4.91157
Monday 4.92379
Tuesday 4.21471
Wednesday 7.42668
Thursday 6.53666
Friday 5.17450
Saturday 4.73175
Total 5.522966

Hour1 Entry MadeAvg.Total
12:00 AM 5.2937
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 4.0048
8:00 AM 4.29133
9:00 AM 6.04290
10:00 AM 5.83274
11:00 AM 4.36192
12:00 PM 6.44348
1:00 PM 3.14132
2:00 PM 5.04227
3:00 PM 7.97303
4:00 PM 3.8199
5:00 PM 6.00168
6:00 PM 4.56114
7:00 PM 8.95188
8:00 PM 8.58163
9:00 PM 5.00115
10:00 PM 6.31101
11:00 PM 4.5732
Total 5.522966

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


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles