Transferring Intellij Live Templates Between Machines

荒凉一梦 提交于 2019-12-10 10:26:23

问题


I'm trying to figure out how to transfer the templates in the /.IdeaC10/config/templates/user.xml file to my coworker's machines.

If I copy into the user.xml file, then those changes seem to be getting squashed by Intellij, reverting to the old file contents.

Anyone know how to work around this?

EDIT:

Is there any way to do this by copying and pasting the xml? That would be preferrable...!


回答1:


Use File | Imprort/Export Settings.




回答2:


the technique of copying and pasting the xml file on another computer in the correct directory, function perfectly for me! But the name of my template file is android.xml for my Android developments. Maybe the file name "user" is protected. Try maybe with a different file name




回答3:


You need to create the required custom template groups and update the relevant predefined groups as necessary and click OK. Based on these changes, IntelliJ IDEA generates the <group_name>.xml files, see Location of Custom Live Templates Definitions above.

Depending on the operating system you are using, the .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

Refer to Intellij Help article.




回答4:


If you have Settings Repository set you may find your Live Templates stored in

<your_user_home_directory>\
  .IntelliJIdea<version>\
    config\
      settingsRepository\
        repository\
          templates



回答5:


An improved and easier way

This allows you to share them easily between collegues.

You can select multiple live templates and then copy them (right click and select copy, or ctrl+c). This gives you XML-descriptions in your clipboard you can send to others.

Other can then take that XML, and paste it into a "Template Group". Right click one of the groups and select Paste. If the option is greyed out, you didn't select a group but something else.



来源:https://stackoverflow.com/questions/7516011/transferring-intellij-live-templates-between-machines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!