How to: Bookmark Code
The Bookmarks window is a handy companion tool to the Code Editor. You can mark lines in your code files with bookmarks and then organize these bookmarks into virtual folders. This enables you to open files and navigate directly to the lines marked simply by clicking entries in the Bookmarks window.
Common procedures for using bookmarks appear below. For information on creating and removing bookmarks in Brief editor mode, see How to: Use Bookmarks with Brief Emulation.
In most Visual Studio programming languages, you can also create Task List shortcuts and comments. As with bookmarks, you can click on any entry in the Task List to open a file and jump to the line of code marked. For more information, see How to: Use Task List Shortcuts and How to: Create Task List Comments.
To create or remove a bookmark using the Bookmarks window
Open a source code file for editing in the Code Editor.
Place the insertion point on the line of code you want to bookmark.
On the View menu, select Bookmark Window.
The Bookmarks window is displayed. It can be docked along any convenient edge of the IDE. The list of bookmark entries includes an entry for the newly bookmarked line in the active document.
Click the Toggle a bookmark button in the Bookmarks window.
A bookmark token appears in the Indicator margin of the Code Editor next to the selected line. Click the button again to remove the bookmark.
To create or remove a bookmark using the Text Editor toolbar
Open a file in the Editor.
Place the insertion point on the line you want to bookmark.
On the View menu, select Toolbars and choose Text Editor.
The Text Editor toolbar is displayed.
Click the Toggle a bookmark button on the Text Editor toolbar.
A bookmark token appears in the Indicator margin of the Editor window next to the selected line. Click the button again to remove the bookmark.
To jump to a bookmarked line
If the bookmarked file is stored under source code control, check out the file.
Click any bookmark entry in the Bookmarks window.
The file indicated opens in the Editor and scrolls to the bookmarked line.
On the Text Editor toolbar, the Move the caret to the previous bookmark and Move the caret to the next bookmark buttons are enabled. In the Bookmarks window, the Go to previous bookmark and Go to next bookmark buttons are enabled.
Click these buttons to navigate to bookmarks in files within the current solution or project.
To organize bookmarks into folders
In the Bookmarks window, click the New Folder button.
A virtual folder is added to the Bookmarks window.
Drag existing bookmark entries into the added folder.
Select and expand the added folder.
The Go to previous bookmark in folder and Go to next bookmark in folder buttons are enabled.
Click these buttons to cycle through the bookmarks stored within that folder.
As each bookmark entry is selected, the file indicated opens in the Editor and scrolls to the bookmarked line.
To change the keyboard shortcut that opens the Bookmarks window
On the Tools menu, choose Options. Expand the Environment folder, and select Keyboard.
The Keyboard, Environment, Options Dialog Box is displayed.
Select the desired Keyboard mapping scheme.
In the Show Commands containing text box, type the View.BookmarkWindow command.
Click in the Press Shortcut key(s) text box, press the desired shortcut keys, and click Assign.