Go To a Line Without Using the Go To Line Dialog

Tips Search

If you like the tips then you'll love the book!

Order your copy today:
http://www.amazon.com/gp/product/0735649928

Go To a Line Without Using the Go To Line Dialog

  • Comments 5

Keyboard:  CTRL + D [find combo box]; CTRL + G [goto line]; ESC [focus back to the editor]
Command:  Edit.GoTo [line number]
Versions:  2008,2010
Published:  6/2/2010
Code:  vstipEdit0067

 

This tip is for those who don't like dialog boxes popping up all the time in their face.  You can execute the GoTo command without invoking the Go To Line dialog box:

image

 

First, press CTRL + D to go to the Find combo box and type in the line number you want to go to:

image

 

Press CTRL + G to go to the line number then press ESC to return the focus to the Editor.

 

NOTE:  Do not press ENTER inside the Find combo box as it will search for the number you typed in your code instead of taking you to the line number.

  • You can also use the CTRL - # shortcut to go to the Find combo box. Useful for Resharper uses, since it replaces CTRL + D with "Duplicate line".

  • Why would anyone want to press two shortcuts instead of just one (CTRL+G)

  • I wondered that myself until I pitched the tip to some friends and one of them in particuar seriously hates modal dialogs so they use this technique.  I guess with muscle memory you can do it pretty quick.

  • Its not working the Ctrl + G in vs2008. Do i need to setup anything?

  • Jepoy :)

    No setup required just press CTRL + D then type a number then press CTRL + G and it should take you to that line number.

    Z

Page 1 of 1 (5 items)
Leave a Comment
  • Please add 5 and 4 and type the answer here:
  • Post