Is there a way to bookmark code in a Visual Studio project?

Viewed 45133

In various projects there are certain parts I will keep jumping to. Is there a way to effectively "bookmark" these parts, so I can quickly jump back to a certain line in a certain file (or a certain method)?

I keep getting lost navigating the solution or doing a "find in whole project/solution".

11 Answers

In Visual Studio, you can set Bookmarks in the code.

To jump between Bookmarks:

Ctrl + K + N (for next)

and

Ctrl + K + P (for previous)

To toggle a Bookmark on/off for a line:

Ctrl + K + K

Yes, press the hotkey combination Ctrl + K + K (that's Ctrl and K, followed by another K) to toggle a bookmark.

Then you can do Ctrl + K + N for the next bookmark and Ctrl + K + P for the previous bookmark.

It works like a charm!

Go to View | Toolbars and check the Text Editor toolbar so it shows up. It has toolbar buttons to Toggle (create/delete) a bookmark on the current line Ctrl-B, T, as well as navigation to the next/prev bookmark, where the navigation is scoped to the solution, folder, or document, depending on which button you use.

Once you have a bookmark created, go to View | Other Windows and select the Bookmark Window (or just press Ctrl-W, B). That will display the list of all the bookmarks. You can double-click any bookmark to jump to it, or use the toolbar button in the Bookmark window for prev/next.

You can also name/rename your bookmarks in the Bookmark window. Right-click on the name and choose rename, or select the name and click it again to enter in to the edit mode.

You can install extension: VSBookmarks

Provides up to nine enumerated bookmarks for every text editor tab. All of them are accessible by shortcuts or via a context-menu (right-click and see for VSBookmark submenu).

Ctrl-Shift-[1..9] - set, change or remove a bookmark (you will see an appropriate digit on the left margin of the editor area); Ctrl-[1..9] - go to a previously set bookmark.

enter image description here

Related