I have 2 bookmarks defined.
When I press Alt+F2 for the first time, it goes to the first bookmark. A second time, it goes to the second bookmark. A third time does nothing…
How to use Alt+F2?
What Alt+F2 (Select All Bookmarks) is for?
If alt+f2
jumps you between different bookmarks, that sounds like some sort of key binding or input issue of some sort; f2
on its own should jump you from bookmark to bookmark in the current file.
The alt+f2
binding to select all bookmarks alters the selection state in the buffer so that every place where there was a bookmark defined gets a cursor placed all at once. If you had 4 bookmarks set in the file, you would see the status bar say 4 selection regions
for example, and typing would insert into all locations at once.
Does the same thing happen if you choose Bookmarks: Select All
from the command palette?
Sorry, you are right.
I hadn’t seen that Alt+F2 creates a multi cursor on each bookmark line.
I’ve been using bookmarks a lot just to navigate inside a large document.
But I still don’t understand the practical application of using Alt+F2 inside a source code.
Could you give some practical ideas for this?
The place the cursor is added is the place the cursor was on the line when you added the bookmark. So, you could for example scan through a file and add bookmarks on the names of specific interesting functions as you go, and then when you get to the end of the file an alt+f2
,ctrl+d
,ctrl+c
would copy them all to the clipboard so you could paste them into documentation or notes, etc.
Basically any operation where you might want to “Save” a cursor location for later, since without this you would have to use the mouse to navigate your click and add extra cusrors.