6. bookmark

Parameter syntax

'add'|'remove'|'removeOrAdd'|'removeAll'|
'go' S 'last'|'anchor'|'lastOrAnchor'|'previous'|'next'|bookmark_id

This command allows to add, visit and remove bookmarks, which is especially useful when working on large documents.

add

If the caret is not already located on a bookmark, add a bookmark at caret position.

With this option, this command returns the ID of the bookmark added at caret position. With the other options, this command does not return any useful information.

remove

If the caret is located on a bookmark, remove this bookmark.

removeOrAdd

If the caret is located on a bookmark, remove this bookmark. Otherwise, add a bookmark at caret position.

removeAll

Remove all bookmarks, if any.

go last

Move caret to the last visited bookmark, if any.

What is the last visited bookmark?

  • The last visited bookmark is the bookmark specified in last executed "bookmark go bookmark_id".

  • A newly added bookmark is automatically made the last visited bookmark.

go anchor

Move caret to the hidden bookmark automatically added at caret position just before last "bookmark go bookmark_id" has been executed. This hidden bookmark, called the anchor, is used to remember ``where the user is coming from''.

go lastOrAnchor

Move the caret to the last visited bookmark. If the caret is already located on the last visited bookmark, move the caret back to the anchor. This option allows to move back and forth from the place where a user is typing some text to the last visited bookmark.

go previous

Move the caret to the bookmark whose position in the document is before the caret. That makes this bookmark the last visited one.

go next

Move the caret to the bookmark whose position in the document is after the caret. That makes this bookmark the last visited one.

go bookmark_id

Moves to caret to the specified bookmark. That makes this bookmark the last visited one.

Examples:

bookmark removeOrAdd
bookmark go lastOrAnchor
bookmark go next
bookmark go bookmark.12345