CLion 2019.1 Help

Source code navigation

You can quickly navigate through code in the editor using different actions and popups.

You can start with watching a video tutorial to check what navigation options are available in CLion.

Find a file path

  1. In the editor, press Ctrl+Alt+F12 or in the context menu, select Reveal in Finder.

  2. In the Reveal in Finder popup, select a file or a directory to open in a path finder and press Enter.

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

  1. If the file is opened in the editor, press Alt+F1 for the Select in popup.

    Select in popup

  2. In the popup, 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 Autoscroll to Source and Autoscroll from Source actions to locate your file in the Project tool window.

  1. In the Project tool window, right-click the Project toolbar and from the context menu select Autoscroll from Source. After that CLion will track the file that is currently opened in the active editor tab and locate it in the Project tool window automatically.

    Context menu

  2. 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

  • To create an anonymous bookmark, place the caret at the needed code line and press F11.

  • To create a bookmark with mnemonics, place the caret at the needed code line, press Ctrl+F11 and select a number or a letter for the mnemonics.

  • To show the next or the previous bookmark, in the main menu select Navigate | Bookmarks | Next Bookmark or Navigate | Bookmarks | Previous Bookmark.

  • To open the Bookmarks dialog, press Shift+F11. You can use this dialog to manage bookmarks, for example, delete, sort bookmarks, or supply them with a brief description.

  • To navigate to an existing bookmark with letter mnemonics, press Shift+F11 and then press a letter you need. CLion returns you to the editor and to the corresponding bookmark.

  • To navigate to an existing bookmark with number mnemonics, press Ctrl and the bookmark's number.

  • 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 you need 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 popup message will show the declaration information:

    Go to definition
    Click once again to navigate to the declaration.

Go to definitions

  • You can keep track of class implementations and overriding functions using either the the Implemented method icon / the Implementing method icon, the Overridden method icon / the Overriding method icon 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 a code element with the Structure view popup

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

  1. To open the structure view popup, press Ctrl+F12.

  2. In the popup, locate an item you need. You can start typing a name of the element for CLion to narrow down the search. Press Enter to return to the editor and the corresponding element.

Browse through methods

  • To navigate to the next or the previous method, press Alt+Down or Alt+Up.

  • To visually separate methods in code, in the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | General | Appearance and select the Show method separators option.

Use the Lens mode

The lens mode lets you preview your code without actually scrolling to it. The mode is available in the editor by default when you hover your mouse over the scrollbar.

  • To disable the lens mode, right-click the code analysis marker located on the right side of the editor and in the context menu clear the Show code lens on the scrollbar hover checkbox.

  • As an alternative, in the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | General | Appearance and clear the Show code lens on the scrollbar hover checkbox.

Find a line or a column

  1. In the editor, press Ctrl+G.

  2. In the Go to Line/Column dialog, specify a line or column number, or both, separating them with: and click OK.

    Go to line/column dialog

  3. If you don't want to see the line numbers in the editor, in the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | General | Appearance and clear the Show line numbers checkbox.

Find the caret, edited line, or edited location

  • To find the current caret location in the editor, press Ctrl+M>. This action might be helpful if you do not want to scroll through a large file.

    However, you can press the Up and Down arrow keys to achieve the same result.

  • To highlight a word at the caret you are trying to locate, select Edit | Find | Find Word at Caret from the main menu.

  • To see on what element the caret is currently positioned, press Alt+Q.

  • To see the previous caret position, press Ctrl+Alt+Left. To move forward, press Ctrl+Alt+Right.

  • To move the caret forward to the next paragraph or backward to the previous one, press Ctrl+Shift+A and search for the Move Caret Forward a Paragraph or Move Caret Backward a Paragraph action.

    You can also select a text and then move the caret forward or backward to a paragraph. Press Ctrl+Shift+A and search for the Move Caret Forward a Paragraph with Selection or Move Caret Backward a Paragraph with Selection action.

    If you need, you can assign shortcuts to these actions. Refer to Keyboard Shortcuts for details.

  • To toggle between the starting and ending code block braces, press Ctrl+Shift+M.

  • To navigate between code blocks, press Ctrl+Shift+[ or Ctrl+Shift+].

  • To navigate to the last edited location, press Ctrl+Shift+Backspace.

Find recent files

You can search for the recent and recently edited files with the Recent Files popup.

  • To open the Recent Files popup with the list of recent files, press Ctrl+E.

    Recent files

  • To see only the recently edited files, press Ctrl+E again or select the Show changed only checkbox.

    Recent files changed only

  • To search for items in the popup, start typing the search query. CLion displays the results based on your search.

Recent files search

Find recent locations

You can also check your recently viewed or changed code using the Recent Locations popup.

  • To open the Recent Locations popup, press N/A. The list starts with the latest visited location at the top and contains code snippets.

    Recent Locations popup
  • While in the popup, use the same shortcut or select the Show changed only checkbox to see only the locations with changed code.

    Recent Locations popup: Show changed only
  • To search for a code snippet, in the Recent Locations popup, start typing your search query. You can search by the code text, filename, or breadcrumbs.

    Search recent locations
  • To delete a location entry from the search results, press either Delete or Backspace.

    Keep in mind that the deleted location is also removed from the list of entries that you access with the Ctrl+Alt+Left shortcut.

Last modified: 24 July 2019