How to bookmark code in Visual Studio in Windows

Microsoft Visual Studio has many features to enhance developer productivity. An important feature that allows you to navigate and return to specific lines of code is the bookmark feature.

This is particularly useful when you are new to a large codebase and need to quickly move to different parts of the codebase.

Open the bookmark window in Visual Studio

  • We can use the Bookmark window to create and manage bookmarks. We can open it as a tab in Visual studio using the View Menu > Bookmark Window.
Use View Menu to open Bookmark Window
Use View Menu to open Bookmark Window
  • The default keyboard shortcut for this is Ctrl+ K, Ctrl+W and can be used to quickly launch the Bookmark window.

Create and Manage Bookmarks

  • To bookmark a line of code, place the cursor on the the line of code you intend to bookmark and use the Toggle Bookmark icon in the bookmark window.
  • Another quick way to bookmark code is to use the keyboard shortcut Ctrl+K, Ctrl+K.
widget

It is important to note that bookmarks are set to line numbers and not code. If the code is modified, the bookmark stays at the same line number. It does not change with the code.

Bookmark Features

  • Bookmarks can be renamed so as to provide meaningful context.
  • Bookmarks can be organized into virtual folders: select New Folder in the bookmark window and then drag the selected bookmarks into the folder.
  • We can easily navigate to the next and previous bookmarks through the bookmarks toolbar buttons or keyboard shortcuts.
  • Bookmarks can be turned offwithout being removed with the Disable All Bookmarks button. They can also be re-enabled later with the Enable All Bookmarks button.
  • Bookmarks can be deleted through the Delete button in the Bookmark Window.

Free Resources