On this page:


Overview



Live Templates are managed on the ​​Live Templates​​​ page of the ​​Settings / Preferences Dialog​​. For your convenience, templates are arranged in groups, most often in accordance with the context



IntelliJ IDEA comes with a set of predefined groups of templates. In addition to them, you can define your own custom groups and templates. It is strongly recommended that you avoid storing custom templates in predefined IntelliJ IDEA groups. For this purpose, use the user



IntelliJ IDEA stores definitions of custom live template groups and templates added to predefined template groups in automatically generated configuration files ​​<group_name>.xml​​.

  • For a custom group, the file contains definitions of all the templates the group includes.
  • For a customized predefined group, the file contains definitions of the added templates only.

Depending on the operating system you are using, the

​<group_name>.xml​​ files are stored at the following locations:

  • Windows: ​​<your_user_home_directory>.IntelliJ IDEA<version_number>\config\templates​
  • Linux: ​​~IntelliJ IDEA<version>\config\templates​
  • OS X: ​​~/Library/Preferences/IntelliJ IDEA<version>/templates​


Managing groups of live templates

  1. Open the ​​Settings / Preferences Dialog​​​ by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or IntelliJ IDEA | Preferences for OS X, and click Live Templates under Editor. The ​​Live Templates​​ page that opens shows all the groups of live templates that are currently configured in IntelliJ IDEA.
  2. Do one of the following:
  • To create a new custom group, click on the toolbar and choose Template Group on the context menu. Then specify the name for the group in the Create New Group
  • To remove a group, select it in the list and click on the toolbar.
  • To add a template to a group, select the group, click , and choose Live Template on the context menu. In the ​​Template editing area​​​, specify the settings for the new template as described in ​​Creating and Editing Live Templates​​.

​Live Template Variables​​ ​​Creating and Editing Live Templates​



See Also





Procedures:





Reference: