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¶
- Open Extensions View: Press
Ctrl+Shift+X
(orCmd+Shift+X
on macOS) to open the Extensions view in VSCode. - Search for Bookmarks: Type "Bookmarks" in the search bar.
- 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:
- Toggle Bookmark: Place your cursor on the line you want to bookmark and press
Ctrl+Alt+K
(orCmd+Alt+K
on macOS) to toggle a bookmark on that line. - Navigate Bookmarks: Use
Ctrl+Alt+L
(orCmd+Alt+L
on macOS) to jump between bookmarks within the same file. To navigate bookmarks across all files, useCtrl+Alt+J
(orCmd+Alt+J
on macOS). - View All Bookmarks: To see a list of all bookmarks, use the
Bookmarks: List
command from the Command Palette (Ctrl+Shift+P
orCmd+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:
- Open Keyboard Shortcuts: Press
Ctrl+K Ctrl+S
(orCmd+K Cmd+S
on macOS). - Search for Bookmarks: Type "bookmarks" in the search bar.
- 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.