Sharing Live Templates
RubyMine stores definitions of custom live template groups and templates added to predefined template groups in automatically generated XML configuration files.
- For a custom group, the file contains definitions of all the templates the group includes.
- For a modified predefined group, the file contains definitions of the added (or modified) live templates only.
Live template group configuration files are stored in the templates directory of the IDE configuration directory. By copying the relevant files in the templates directory, you can share live templates among team members and multiple RubyMine installations. Moreover, you can share live templates across all IDEs based on the IntelliJ platform.
RubyMine provides the export and import functionality for sharing live templates, which may be more convenient than copying configuration files manually.
To export live template configuration:
- On the menu, click .
- In the Export Settings dialog, make sure that the Live templates check box is selected and specify the path and name of the JAR file, where the exported settings will be saved.
- Click OK to generate the file based on live template configuration files. You can share this file with your team members, or import it on another RubyMine installation.
To import live template configuration:
- On the menu, click .
- Specify the path to the JAR file with the exported live template configuration.
- In the Import Settings dialog box, select the Live templates check box and click OK.
- Wait for RubyMine to restart and you should see the imported live templates on the Live Templates page of the Settings / Preferences Dialog.
Example of sharing templates between different IDEs
If you import custom templates (updates) from a group that is predefined in the source IDE but is not predefined in the target IDE, such group will be created but will contain only the custom templates (no default predefined templates). The following example illustrates what happens when adding a custom template to a predefined group in WebStorm and then reusing it in PhpStorm.
In WebStorm, the Dart template group is predefined. If you add the
t (tag pair) template to it, this update will be saved in the
In PhpStorm, there is no predefined template group Dart. So when you export live templates from WebStorm and then import them into PhpStorm, the Dart group is created, but it contains only one template
t (tag pair), which was added to the group in WebStorm before export: