Skip to content

Bookmarks

In Visual Studio Code (VSCode), bookmarking specific lines or sections of code for easy navigation and reference is a helpful feature, especially in large projects. VSCode does not have a built-in bookmarking feature, but this functionality can be easily added through extensions. One of the most popular extensions for this purpose is "Bookmarks" by Alessandro Fragnani.

Here's how you can use it:

Installing the Bookmarks Extension

  1. Open Extensions View: Press Ctrl+Shift+X (or Cmd+Shift+X on macOS) to open the Extensions view in VSCode.
  2. Search for Bookmarks: Type "Bookmarks" in the search bar.
  3. Install the Extension: Find the "Bookmarks" extension by Alessandro Fragnani and click on the install button.

Using the Bookmarks Extension

Once installed, you can start using the extension to bookmark lines of code:

  1. Toggle Bookmark: Place your cursor on the line you want to bookmark and press Ctrl+Alt+K (or Cmd+Alt+K on macOS) to toggle a bookmark on that line.
  2. Navigate Bookmarks: Use Ctrl+Alt+L (or Cmd+Alt+L on macOS) to jump between bookmarks within the same file. To navigate bookmarks across all files, use Ctrl+Alt+J (or Cmd+Alt+J on macOS).
  3. View All Bookmarks: To see a list of all bookmarks, use the Bookmarks: List command from the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).

Additional Features

  • Labeling Bookmarks: You can add labels to your bookmarks for more descriptive navigation.
  • Saving Bookmarks: The extension automatically saves your bookmarks, and they will persist across VSCode sessions.
  • Bookmarks in Multiple Files: The extension supports bookmarking lines across multiple files in your project.

Customizing Shortcuts

If you want to change the default keyboard shortcuts:

  1. Open Keyboard Shortcuts: Press Ctrl+K Ctrl+S (or Cmd+K Cmd+S on macOS).
  2. Search for Bookmarks: Type "bookmarks" in the search bar.
  3. Customize Shortcuts: Click on the edit icon next to the command you want to change and assign a new keybinding.

By using the Bookmarks extension, you can efficiently navigate and keep track of important sections in your code. Remember to explore the extension's settings and features for additional customization and functionality.