Visual Studio Keyboard Shortcut Tip: Ctrl+-

Published 24 November 08 10:17 AM | Scott Mitchell

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.

Filed under:

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Archives

My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.