CLion 2018.3 Help

Navigating through the source code

You can quickly navigate within your source code using different action such as autoscroll, bookmarks, or the Select In pop-up. You can also look up a symbol declaration and its type, see implementations, and quick definitions.

For more information on navigation, check the navigation between editor and tool windows and navigation inside the editor sections.

You can automatically locate a target in the Project tool window.

  1. If the file in question is opened in the editor, press Alt+F1 for the Select in pop-up.

    Select in pop-up

  2. In the pop-up, select Project View and press Enter.

    CLion locates your target in the Project View window.

Use Autoscroll to locate a file

You can use the scroll to and from actions to locate your file in the Project view.

  1. In the Project tool window, right-click the Project area.

    Context menu

  2. From the context menu, select Autoscroll from Source. CLion tracks a file that is currently open in the editor and locates it in the Project view automatically.

  3. You can also select the Autoscroll to Source option. In this case, when you click a file in the Project view, CLion will automatically open it in the editor.

Use bookmarks for navigation

You can add a bookmark to any line of your code.

  1. On the desired line of code, press the following shortcuts:
    • F11 to create an anonymous bookmark.

    • Press Ctrl+F11 and select a number or a letter to create a book mark with mnemonics.

  2. Press N/A or N/A to show next or previous bookmark.

  3. Press Shift+F11 to open the Bookmarks dialog where you can manage bookmarks, for example, you can delete, sort bookmarks, or supply them with a brief description.

  4. If you have a bookmark with letter mnemonics, press Shift+F11 and press the letter you need. CLion returns you back to the editor and to the corresponding bookmark.

  5. If you need to navigate to an existing bookmark with number mnemonics, press Ctrl and the bookmark's number.

  6. Every created bookmark is reflected in the Favorites (Alt+2) tool window which you can also use for navigation to your bookmarks.

Breadcrumbs help keeping track of your location inside the hierarchy of scopes in the file opened in the active editor tab. For C++, breadcrumbs represent namespaces, classes, structures, functions, and lambdas:

CLion breadcrumbs
To jump to an element in the code, click the breadcrumb with its name.

  1. By default, breadcrumbs are shown and positioned at the bottom of the editor. To hide or relocate them, right-click a breadcrumb and choose Breadcrumbs | Top or Breadcrumbs | Don't show, or configure their placement in Settings / Preferences | Editor | General | Breadcrumbs.

  2. In the same Breadcrumbs settings dialog, you can also enable/disable breadcrumbs for a particular language by selecting/clearing the corresponding checkbox.

  3. To configure colors for breadcrumbs highlighting, go to Settings / Preferences | Editor | Color Scheme | General, and choose Editor | Breadcrumbs from the list.

Go to declarations

You can navigate to declaration of a variable, function, class, or type from its usage:

  • Place a caret at a symbol in question and press Ctrl+B.

  • For a type declaration, press Ctrl+Shift+B.

  • You can also point to the symbol keeping Ctrl pressed, and click, when it turns to a hyperlink. The pop-up message will show the declaration information:

    cl navigate to definition2
    Click once again to navigate to the declaration.

Go to definitions

  • You can keep track of class implementations and overriding functions using either the icons gutter implementedMethod svg / icons gutter implementingMethod svg, icons gutter overridenMethod svg / icons gutter overridingMethod svg gutter icons or the appropriate shortcuts.

  • Press Ctrl+Alt+B to navigate to the definition of a code entity at the caret (variable, function, class).

  • Press Ctrl+U to navigate to the super definition.

go to definition

Locate the source code element with Structure view

You can use the structure view pop-up to locate a code element in the file you are working on.

  1. Press Ctrl+F12 to open the structure view pop-up.

  2. In the pop-up, locate the item you need. You can start typing the name of the element and CLion narrows down the search. Press Enter to return back to the editor, and the corresponding element.

If you want to browse through methods in the editor, you can use the Alt+Down / Alt+Up shortcut to navigate to next or previous method.

Moreover, you can visually separate methods in your code. To do that, open the Settings/Preferences (Ctrl+Alt+S) dialog, go to | Editor | General | Appearance and select the Show method separators option.

Last modified: 18 December 2018