Source code navigation
You can quickly navigate through code in the editor using different actions and popups. For the detailed information on navigating between the editor and tool windows, check the editor basics.
To navigate backwards, press CtrlAlt0←. To navigate forward, press CtrlAlt0→.
To quickly move to the top of the editor, press CtrlPg Up. Alternatively, press CtrlPg Dn to move the caret to the bottom of your editor.
To navigate to the last edited location, press CtrlShiftBackspace.
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 0↑ and 0↓ arrow keys to achieve the same result.
To highlight a word at the caret you are trying to locate, select Edit | Find | Next Occurrence of the Word at Caret from the main menu. If you are using Windows, you can also press Ctrl+F3.
To see on what element the caret is currently positioned, press Alt0Q.
To move caret between matching code block braces, press CtrlShift0M.
To navigate between code blocks, press Ctrl0[ or Ctrl0].
You can use different actions to move the caret through code. You can also configure where the caret should stop when moved by words and on line breaks.
To move the caret to the next word or the previous word, press Ctrl0→ or Ctrl0←.
By default, CLion moves the caret to the end of the current word.
When you move the caret to the previous word, the caret is placed at the beginning of the current word. You can configure the position of the caret when you use these actions.
In the Settings dialog (CtrlAlt0S) , go to Editor | General. In the Caret Movement section, use the When moving by words and Upon line break options to configure the caret's behavior.
To move the caret forward to the next paragraph or backward to the previous one, press CtrlShift0A 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 CtrlShift0A 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. For more information, refer to Keyboard shortcuts.
You can also check your recently viewed or changed code using the Recent Locations popup.
To open the Recent Locations popup, press CtrlShift0E. The list starts with the latest visited location at the top and contains code snippets.
While in the popup, use the same shortcut or select the Show changed only checkbox to see only the locations with changed code.
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.
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 CtrlAlt0← shortcut.
You can navigate to the declaration of a variable, function, class, or type from its usage:
Place a caret at a symbol and press Ctrl0B.
For a type declaration, press CtrlShift0B.
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. Click once again to navigate to the declaration.
The Go to Declaration or Usages action (CtrlShift0B) works differently for different cases:
When invoked on a symbol usage, it navigates to that usage’s declaration.
When invoked on a declaration, it shows the list of that declaration’s usages.
When invoked on a definition, it shows the associated declaration.
You can choose between the first two options using the switcher in Settings | Editor | General:
![Go to Declaration or Usages behavior Go to Declaration or Usages behavior](https://resources.jetbrains.com/help/img/idea/2024.3/cl_goto_decl_setting.png)
The default option is Show usages popup:
![Go to Declaration showing usages Go to Declaration showing usages](https://resources.jetbrains.com/help/img/idea/2024.3/cl_goto_decl_showusages.png)
If you select Jump to predeclaration, the action navigates you to the declaration if it exists:
![https://resources.jetbrains.com/help/img/idea/2024.3/cl_goto_decl_def.png](https://resources.jetbrains.com/help/img/idea/2024.3/cl_goto_decl_def.png)
You can keep track of class implementations and overriding functions using either the
/
,
/
gutter icons or the appropriate shortcuts.
Press CtrlAlt0B to navigate to the definition of a code entity at the caret (variable, function, class).
Press Ctrl0U to navigate to the super definition.
![go to definition go to definition](https://resources.jetbrains.com/help/img/idea/2024.3/cl_navigate_to_definition.png)
To switch between source and header files, you can use the dedicated Go to Header/Source action instead of Go to Related Symbol.
To invoke Go to Header/Source, press F10 or call Navigate | Header/Source from the main menu.
The action either opens a file in the editor right away or shows the popup with the available options:
GifWhile searching for the target file, Go to Header/Source uses a few heuristics:
The most recent switched file is always at the top of the list.
Next goes the file with the matching name from the same directory, if any (for example, myfile.h/myfile.cpp).
Then, a definition/declaration-based search is performed in the background, and new items are added to the popup.
If no single destination is found within 500 ms, CLion shows an interactive popup where new items are added, and you can select where you want to navigate to.
note
Currently, the search is limited to direct includers/includees to avoid interference from the same symbols from different targets.
If you are accustomed to Go to Related Symbol for switching between header and source files, you can remap its shortcut to Go to Header/Source.
Once per installation, CLion will prompt you to do that when you invoke Go to Related Symbol via the shortcut in a C/C++ file (if the non-default shortcut is not yet set for Go to Header/Source):
You can also configure the desired shortcuts in Settings | Keymap.
You can automatically locate a target in the Project tool window.
If the file is opened in the editor, press AltF1 for the Select in popup.
In the popup, select Project View and press Enter.
CLion locates your target in the Project View window.
You can use the Open Files with Single Click (previously called Autoscroll to Source) and Always Select Opened Files (previously called Autoscroll from Source) actions to locate your file in the Project tool window.
In the Project tool window, right-click the Project toolbar and from the context menu, select Behavior.
Enable Always Select Opened File. 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.
You can also select the Open Files with Single Click option. In this case, when you click a file in the Project view, CLion will automatically open it in the editor.
You can use the structure view popup to locate a code element in the file you are working on.
To open the structure view popup, press CtrlF12.
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.
Press Alt0↓ or Alt0↑.
To visually separate methods in code, in the Settings dialog (CtrlAlt0S) , go to Editor | General | Appearance and select the Show method separators option.
To open the Structure tool window, press Alt07.
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 over the scrollbar. It is especially useful when you hover over a warning or an error message.
![Lens mode Lens mode](https://resources.jetbrains.com/help/img/idea/2024.3/cl_editor_lensmode.png)
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 dialog (CtrlAlt0S) , go to Editor | General | Appearance and clear the Show code lens on the scrollbar hover checkbox.
Breadcrumbs display the path from the code element where your caret is placed to the root element of the file. They help you track your location within a file's hierarchy.
Each part of the breadcrumb is clickable, allowing easy navigation to parent code elements. You can also use tooltips for additional information, which appear when you hover over a breadcrumb section.
Breadcrumbs are enabled by default for some programming languages. You can select the languages in settings.
To change the location of breadcrumbs, right-click a breadcrumb in the editor, go to Appearance | Breadcrumbs, and select a new location: at the top or at the bottom of the editor.
To edit the settings for breadcrumbs, enable or disable breadcrumbs for other languages, or change their appearance, press CtrlAlt0S to open settings and then select Editor | General | Breadcrumbs.
Clear the Show breadcrumbs option to hide breadcrumbs in the editor.
In the editor, press Ctrl0G.
In the Go to Line/Column dialog, specify a line or column number, or both, separating them with : and click OK.
If you don't want to see the line numbers in the editor, in the Settings dialog (CtrlAlt0S) , go to Editor | General | Appearance and clear the Show line numbers checkbox.
note
For quicker access, assign a shortcut to the Show line numbers action.
In the editor, press CtrlAltF12 or in the context menu, select Open in | Finder.
In the Reveal in Finder popup, select a file or a directory to open in the path finder and press Enter.
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 Ctrl0E.
To see only the recently edited files, press Ctrl0E again or select the Show changed only checkbox.
To search for items in the popup, use the Speed Search functionality. Just start typing a search query, and the Search for field appears. CLion displays the results based on your search query, the list shrinks as you type.
![Recent files search Recent files search](https://resources.jetbrains.com/help/img/idea/2024.3/cl_recent_files_search.png)
Thanks for your feedback!