
Navigate Your Source Code #20
Chapter 3, Navigating Visual Studio
|
89
HACK
See Also
• “Test Regular Expressions in Visual Studio” [Hack #100]
—Ben Von Handorf
HACK
#20
Navigate Your Source Code Hack #20
Visual Studio lets you go way beyond moving around with the arrow, Page
Up, and Page Down keys. Learn some keyboard tricks that let you move
around in different ways.
Visual Studio provides a number of ways to navigate through your source
code. This hack will cover how to use a number of helpful shortcuts as well
as how to use bookmarks to quickly move around in your code.
Navigation Shortcuts
The normal method of moving around in your source code with the mouse
is perfectly acceptable, but it is also slow. When you are busy typing, it takes
time to reach for the mouse, orient the cursor, and then move to another
section of code by clicking on a line. Visual Studio contains a number of
navigational shortcuts that can keep your hands on the keyboard and help
you write code faster.
Navigation history. The first two commands that you can use to navigate are
the View.NavigateBackward (Ctrl and -) and View.NavigateForward (Ctrl-
Shift and -) commands. These keystrokes can best be described as undo and
redo commands, but instead of undoing or redoing actions, these key-
strokes undo and redo navigation. For instance, if you are working in one
method, then use the mouse to move over to another method, you can