Are there bookmarks in Visual Studio Code?
How can I set bookmarks in Visual Studio Code? I can't find any keyboard shortcuts.
Or is there anything else that I can use instead?
Yes, via extensions. Try Bookmarks extension on marketplace.visualstudio.com
Hit Ctrl+Shift+P and type the install extensions
and press enter, then type Bookmark
and press enter.
Next you may wish to customize what keys are used to make a bookmark and move to it. For that see this question.
You need to do this via an extension as of the version 1.8.1.
-
Go to View → Extensions. This will open Extensions Panel.
-
Type
bookmark
to list all related extensions. -
Install
I personally like "Numbered Bookmarks" - it is pretty simple and powerful.
Go to the line you need to create a bookmark.
Click Ctrl + Shift + [some number]
Ex: Ctrl + Shift + 2
Now you can jump to this line from anywhere by pressing Ctrl + number
Ex: Ctrl + 2
Visual Studio Code currently does not support bookmarks natively. Please add this as feature request to our Git Hub issue list (https://github.com/Microsoft/vscode).
In the meantime there are some ways to navigate around the code based on your navigation history. You can Ctrl+Tab to quickly jump to previously opened files. You can also navigate within your code based on cursor positions using Goto | Back and Goto | Forward.
Both VS Code extensions can be used:
- 'Bookmarks'
- 'Numbered Bookmarks'
Personally, I'm suggesting: Numbered Bookmarks, with 'navigate through all files' option:
- ctrl + Shift + P in VS Code
- In newly open field, type: Open User Settings
- Paste this key/value: "numberedBookmarks.navigateThroughAllFiles": "allowDuplicates" (allow duplicates of bookmarks),
- Or, paste this key/value: "numberedBookmarks.navigateThroughAllFiles": "replace"
NOTE
Either way, be careful with shortcuts (Ctrl+1, Ctrl+Shift+1,..) that are already assigned.
Personally, mine were in 2 conflicts, with:
- VS Code shortcuts, that already exists,
- Ditto clipboard (I've got paste on each call of bookmark)
The bookmarks extension mentioned in the accepted answer conflicts with toggling breakpoints via the margin.
You could do the same with breakpoints and select the debug tab on the left to see them listed. Better yet, use File, Preferences, Keyboard Shortcuts and set (Shift+)Ctrl+F9 to navigate between them, even across files: