Like many text editors, RubyMine supports bookmarks. A bookmark is a reference to a particular line in a file. They are visually indicated by an icon in the editor gutter. Bookmarks can be used as a form of navigation based on interested parts of a codebase. In this post, we’ll explore (using the Mac OS X 10.5+ keymap) the three types of bookmarks in RubyMine: anonymous, numbered, and lettered.
Anonymous Bookmarks
Anonymous bookmarks can be created with F3
. They appear as a checkmark icon in the editor gutter.
Unfortunately, there are no default keyboard shortcuts to navigate anonymous bookmarks. Instead, use the Find Action command,command + shift + A
, to search for the “Next Bookmark” and “Previous Bookmark” anonymous bookmark navigation commands. These commands will only navigate through anonymous bookmarks in the current file.
Mnemonic Bookmarks
There are two types of mnemonic bookmarks: numbered and lettered.
Numbered Bookmarks
You can have up to 10 numbered bookmarks: 0-9. To create a numbered bookmark, press control + shift + <number>
, e.g., control + shift + 4
.
To navigate to a numbered bookmark press control + <number>
, e.g., control + 4
.
Lettered Bookmarks
You can have up to 26 lettered bookmarks: A-Z. To create a lettered bookmark press option + F3
, then choose a letter to use for the bookmark.
To navigate lettered bookmarks, use the bookmarks dialog (discussed below), command + F3
.
Deleting Bookmarks
All three types of bookmarks can be deleted by pressing F3
when on the bookmarked line.
Viewing Bookmarks
You can view all existing bookmarks with command + F3
.
This dialog also allows you to delete, and navigate bookmarks.
Last Edit Location “Bookmark”
When editing, it’s common to stop for a second to view another part of the file (or a different file), and then navigate back to the original edit location.
Instead of using bookmarks to quickly navigate back to the original edit location, use the Last Edit Location command, command + shift + Backspace
.
Experimenting with Bookmark Navigation
After trying out the different types of bookmarks in RubyMine, I find numbered bookmarks to be the most useful. They are both easy to create and navigate. Lettered bookmarks offer a greater number of possible bookmarks, but navigating them requires several commands. I think anonymous bookmarks could also be useful, if you create shortcuts for their navigation commands.
Try them all and see what works best for you.