CLion 2024.3 Help

Bookmarks

If you work with large projects, searching for files and folders can be time-consuming. For such cases, CLion features bookmarks. You can bookmark the necessary lines of code to be able to find them easier. You can also bookmark the project files and folders that you need more often than other project items.

Bookmarks example

All your bookmarks are grouped in lists in the Bookmarks tool window that you can open by selecting View | Tool Windows | Bookmarks from the main menu or by pressing Alt+2. The tool window also shows all breakpoints that are automatically added to the dedicated list once you place them in your code.

Bookmarks tool window

CLion has two types of bookmarks:

  • Anonymous bookmarks don't have an identifier and allow you to place as many bookmarks as you want. Files and lines marked with anonymous bookmarks have a bookmark icon.

  • Mnemonic bookmarks allow you to create bookmarks with numbers (0 to 9) or letters (A to Z). Files and lines marked with mnemonic bookmarks have the corresponding letter or number icon in a frame.

Add bookmarks

CLion adds your bookmarks to the predefined list in the Bookmarks tool window that is created automatically and has the same name as the project. You can create more lists and set another list as default.

Add an anonymous line bookmark

  • In the editor, place the caret at a line of code and press F11.

  • Alternatively, right-click the gutter next to the line of code that you want to bookmark and select Add Bookmark.

A bookmark icon appears in the gutter next to the bookmarked line.

Anonymous bookmark placed in the editor

Add a mnemonic line bookmark

  1. In the editor, place the caret at a line of code and press Ctrl+F11.

    Alternatively, right-click the gutter next to the line of code that you want to bookmark and select Add Mnemonic Bookmark.

  2. In the popup that opens, select a number or a letter that you want to use as an identifier for this bookmark.

    Adding a mnemonic bookmark: select an identifier

    If the selected mnemonic is already used, the IDE will ask you whether you want to overwrite an existing bookmark with the new one. Select the Don't ask again option to silently overwrite mnemonics.

  3. Optionally, provide a description for the new bookmark.

  4. Press Enter or click the selected letter or number once again to save the bookmark.

    A letter or a number bookmark icon appears in the gutter next to the bookmarked line.

    Mnemonic bookmark added in the gutter

Bookmark files and folders

  1. In the Project tool window Alt+1, right-click an item that you want to bookmark and select Bookmarks | Add Bookmark (F11) or Add Mnemonic Bookmark (Ctrl+F11).

    To bookmark multiple items, select them in the tool window, right-click one of them, and select Bookmarks | Add Bookmarks (F11).

  2. For mnemonic bookmarks, select a number or a letter that you want to use as an identifier for this bookmark.

    Press Enter or click the selected letter or number once again to save the bookmark.

Bookmark an editor tab

You can bookmark files from editor tabs one by one. These bookmarks will be added to the default list.

  1. Right-click the tab with the file that you want to bookmark and select Bookmarks | Add Bookmark (F11) to add an anonymous bookmark or Add Mnemonic Bookmark (Ctrl+F11) to add a bookmark with an identifier.

  2. For mnemonic bookmarks, select a number or a letter that you want to use as an identifier for this bookmark.

    Press Enter or click the selected letter or number once again to save the bookmark.

Bookmark all editor tabs

You can quickly bookmark all open files and add these bookmarks to the new list.

  1. Click the Recent Files, Tab Actions, and More icon that is on the tab bar and select Bookmark Open Tabs.

    Bookmarking all open tabs
  2. Name the new list.

    Naming a list of bookmarks

    You can use this list for new bookmarks by default: enable the Use as default list option.

    The IDE will create a new list and add to this list all files from the open tabs.

    Lists of bookmarks

Jump to a mnemonic bookmark with a digit

  • Hold Ctrl and press the mnemonic digit on the keyboard.

    For example, to jump to the bookmark with mnemonic 5, press Ctrl+5.

Jump to a mnemonic bookmark with a letter

By default, the shortcuts for navigating to bookmarks with letter mnemonics are not assigned, but you can set your custom shortcuts.

  1. Press Ctrl+Alt+S to open settings and then select Keymap.

  2. In the list of shortcuts, expand Other | Bookmarks | Go to by Number/Mnemonic and configure shortcuts as you like.

  3. Press the configured shortcuts to navigate to letter bookmarks in the editor.

By default, the shortcuts for navigating line bookmarks are not assigned, but you can set custom shortcuts.

  1. Press Ctrl+Alt+S to open settings and then select Keymap.

  2. In the list of shortcuts, expand Other | Bookmarks and configure shortcuts for:

    • Next Line Bookmark/Previous Line Bookmark to navigate all line bookmarks.

    • Next Line Bookmark in Editor/Previous Line Bookmark in Editor to navigate bookmarks in open files.

  1. Press Shift+F11 or go to Edit | Bookmarks | Show Line Bookmarks in the main menu.

  2. Double-click the bookmark or select it with the keyboard and press Enter.

    For mnemonic bookmarks, press the corresponding digit or letter.

By default, CLion shows only line bookmarks in the bookmarks popup. You can configure the settings to see other bookmarked items (for example, files or folders): press Ctrl+Alt+S to open the IDE settings, select Advanced Settings, and disable the Show only line bookmarks in popup option.

  1. In the main menu, go to View | Tool Windows | Bookmarks or press Alt+2 to open the Bookmarks tool window.

  2. Expand the desired bookmark list or click Expand all to expand all lists.

  3. Double-click a bookmark on the list to navigate to it or press:

    • Ctrl+Alt+Down (Navigate | Next Bookmark Occurrence) to jump to the next bookmark.

    • Ctrl+Alt+Up (Navigate | Previous Bookmark Occurrence) to return to the previous bookmark.

Modify bookmarks

Rename bookmarks

  1. Do one of the following:

    • Right-click the bookmark icon in the gutter and select Rename Bookmark

    • Select a bookmark in the Bookmarks tool window and click or press F2.

  2. Provide a new description:

    Renaming a bookmark in the editor

Assign a mnemonic to an anonymous bookmark

You can convert an anonymous bookmark to a mnemonic one.

  1. Right-click a bookmark icon in the editor gutter, a bookmarked item in the Project tool window Alt+1 or a bookmark in the Bookmarks tool window, and select Assign Mnemonic (or press Ctrl+F11).

  2. In the popup that opens, select a number or a letter that you want to use as an identifier for this bookmark.

    Optionally, provide a description.

  3. Press Enter or click the selected letter or number once again to save the bookmark.

Change a mnemonic identifier

  1. Right-click a bookmark icon in the editor gutter, a bookmarked item in the Project tool window Alt+1, and select Change Mnemonic (or press Ctrl+F11).

  2. In the popup that opens, select another identifier. If necessary, change the description as well.

  3. Press Enter or click the selected letter or number once again to save the bookmark.

Anonymize mnemonic bookmarks

You can convert a mnemonic bookmark to an anonymous one.

  • Right-click a bookmark icon in the editor gutter, a bookmarked item in the Project tool window Alt+1, or a bookmark in the Bookmarks tool window, and select Remove Mnemonic.

Delete bookmarks

  • To delete a bookmark from the Bookmarks tool window or from the gutter, right-click it and select Delete Bookmark.

  • To delete a bookmark from the Project tool window Alt+1, right-click a bookmarked item and select Bookmarks | Delete Bookmark.

Lists of bookmarks

There's one predefined empty bookmark list that has the same name as the project. By default, CLion adds your bookmarks there. If necessary, you can use another list as the default. You can also create multiple lists and move items between them.

Create a bookmark list

  1. In the main menu, go to View | Tool Windows | Bookmarks or press Alt+2 to open the Bookmarks tool window.

  2. In the tool window, click Create Bookmarks List and name the new list in the dialog that opens.

  3. Enable the Use as default list option if you want your bookmarks to go to this list automatically and click Create.

Move a bookmark to another list

  • Go to View | Tool Windows | Bookmarks or press Alt+2 to open the Bookmarks tool window and drag a bookmark to another list.

  • In the Project tool window Alt+1, right-click a bookmarked item and select Bookmarks | Add Bookmark to Another List.

Sort bookmarks

  • To move a bookmark up or down the list, right-click it in the Bookmarks tool window and select Move Up or Move Down.

  • To display line bookmarks in the tool window grouped by file, click Options in the Bookmarks tool window and select the Group Line Bookmarks by File option.

Change the default list

CLion adds all your bookmarks to the list that is configured as the default one. If necessary, you can use another default list for your bookmarks.

  1. In the main menu, go to View | Tool Windows | Bookmarks or press Alt+2 to open the Bookmarks tool window.

  2. Right-click the list that you want to use as your default bookmark list and select Mark List as Default.

    The list is now located above others in the tool window and has the Default tag.

Delete a list of bookmarks

After you delete a list, all bookmarks from it are removed from code and project items.

  1. In the main menu, go to View | Tool Windows | Bookmarks or press Alt+2 to open the Bookmarks tool window.

  2. Right-click the list that you want to delete and select Delete Bookmark List.

Last modified: 22 November 2024