This is a quick post about IntelliJ’s nice bookmark feature.
IntelliJ gives you the option to bookmark single lines of code. After a line has been bookmarked, you can use various ways to jump directly back to this line. So it can be a good idea to bookmarks code locations you often work with.
To create a new bookmark you only have to press F11 inside the code editor. Bookmarked lines show a small checkmark next to the line number.
Bookmarks can be removed by selecting the bookmarked line and pressing F11 again.
To see all bookmarks you can press Shift - F11. This opens a small popup window which shows a list of all bookmarks you have created.
Note that this window can completely controlled using the keyboard:
- With Up / Down you can browse the list of bookmarks
- With Enter you jump to the selected bookmark
- Esc closes the window
- A bookmark can be moved up or down using Alt - Up / Alt - Down
Note that you can also add a mnemonic identifier to a bookmark. You do this by selecting a line and pressing Ctrl - F11. This opens a small menu in which you can choose a mnemonic identifier (which is a character or a number).
You can choose an identifier by clicking on one of the menu buttons or by simply pressing the corresponding key on your keyboard.
Bookmark mnemonics are also shown next to the line number. In the following image 1 was choosen as mnemonic.
Mnemonics give you the option to move even quicker between bookmarks. You can directly jump to a mnemonic bookmark by opening the bookmark popup (Shift - F11) and pressing the mnemonic key (1 in this example).
For numerical bookmarks even more shortcuts are available. You can toggle a numeric mnemonic on a selected line by pressing
Ctrl - Shift - <number>. If you want to jump to a numeric mnemonic you use the
Ctrl - <number> shortcut.
Ctrl - 5 brings you directly to the mnemonic bookmark 5.