Live Templates for C++
On this page, you can configure and create live templates for C++ code.
Use live templates to insert common constructs into your code, such as loops, conditions, declarations, or print statements.
Select the template from the list. The bottom-left pane will show the expanded stub code. Use this pane if you need to edit the template.
Table below describes the controls of the bottom-right area of the dialog:
Shortcut | Use this abbreviation to insert the live template. Press Tab after you type it in the editor. |
Description | This field gives a brief description of each template. |
Options | Use these checkboxes to reformat the inserted code and shorten the qualified names. |
Availability | Click this button to open the Availability configuration dialog. In this dialog, specify the context where the template will be applied. |
Use in | Choose whether the template will be applied in code generation, the Surround With action, or both. |
Show in context action | With this option enabled, the applicable template will be shown in the actions menu. |
Edit variables | Click to open the dialog where you can edit the template variables. |
Surround a block of code with a live template
You can quickly surround a block with one of the available live templates.
In the editor, select the piece of code to be surrounded.
Press Ctrl+Alt+J.
Select the desired template from the list:
CLion Nova will surround the code with the selected template: