简体   繁体   English

有没有办法在 JetBrains IDE 之间同步设置?

[英]Is there a way to sync settings across JetBrains IDEs?

What is the best way to sync similar settings across JetBrains IDEs?JetBrains IDE 之间同步类似设置的最佳方法是什么? For example I have PyCharm and PhpStorm , both of which support CSS and HTML, and I would like to have all of the syntax coloring, inspections, etc. be the same for both PyCharm and PhpStorm.例如,我有PyCharmPhpStorm ,它们都支持 CSS 和 HTML,我希望PyCharmPhpStorm 的所有语法着色、检查等都相同。 Similarly, I have TODO patterns in both IDEs that I'd like to synchronize.同样,我在两个 IDE 中都有想要同步的 TODO 模式。

Is there a way to accomplish this that's reliable and not to tedious or complicated?有没有办法做到这一点,既可靠又不乏味或复杂?

现在有了Settings Repository 插件,但它在跨 IDE 同步方面仍然存在大量错误。

不,没有,但是有一个开放的功能请求将其添加到 JetBrains 的 IDE。

Not relevant to the question asked, but possibly helpful in other situations:与提出的问题无关,但在其他情况下可能有帮助:

Setting Repositories设置存储库

The first way to synchronize settings is using Settings Repositories.同步设置的第一种方法是使用设置存储库。 The way it works is that it uses an external Git repository to share the settings.它的工作方式是使用外部 Git 存储库来共享设置。 Each IDEA instance then connects to this repository to fetch the settings.然后每个 IDEA 实例连接到这个存储库以获取设置。 In case one instance makes changes in the settings it can be propagated back to the repository.如果一个实例对设置进行了更改,则可以将其传播回存储库。 What's nice is that it is a plain old Git repo.好的是它是一个普通的旧 Git 存储库。 That means your settings are backed up and under version control.这意味着您的设置已备份并处于版本控制之下。 So you can track and rollback the changes if necessary or even allow other people to create Pull Requests with some tweaks to your settings.因此,您可以在必要时跟踪和回滚更改,甚至允许其他人通过对您的设置进行一些调整来创建拉取请求。

To enable this feature just go to:要启用此功能,只需转到:

File → Settings Repository

To configure multiple repositories go to要配置多个存储库,请转到

Settings → Tools → Settings Repository

What is it good for?到底有什么好处呢? Well, maybe there are some settings you want to share with your teammates to ensure consistency on your project.好吧,也许您想与队友分享一些设置,以确保项目的一致性。 But then, of course, you want some of your setting to be personal and just for you.但是,当然,您希望您的某些设置是个性化的,并且只适合您。 After all, every user has different preferences.毕竟,每个用户都有不同的偏好。

Synchronize settings using JetBrains Account使用 JetBrains Account 同步设置

The second way of settings synchronization was available for some time as a standalone optional IDE plugin (which required an invitation to use), but now is integrated and enabled by default since 2017.3.第二种设置同步方式作为独立的可选 IDE 插件(需要邀请使用)已有一段时间了,但现在自 2017.3 以来默认集成和启用。 It utilizes your JetBrains account to synchronize the data.它利用您的 JetBrains 帐户来同步数据。

Under the hood, it actually uses a variation of Settings Repository mechanism, but you are shielded from it.在幕后,它实际上使用了 Settings Repository 机制的一种变体,但您不受它的影响。 It is much more convenient because you don't have to create a Git Repo to store the settings and provide its address to your IDE.它更方便,因为您不必创建 Git Repo 来存储设置并将其地址提供给您的 IDE。 On top of that, unlike Settings Repositories, it allows you to also synchronize your installed plugins.最重要的是,与设置存储库不同,它还允许您同步已安装的插件。

The first thing you need to do is to make sure you have a JetBrains account.您需要做的第一件事是确保您拥有 JetBrains 帐户。 Once you have your JetBrains account, you'll need to Log in to IDEA using it.拥有 JetBrains 帐户后,您需要使用它登录 IDEA。 Just head to Help → Register.只需前往帮助 → 注册。 Then you just need to select Activate new License with JetBrains Account and enter your credentials.然后,您只需选择使用 JetBrains 帐户激活新许可证并输入您的凭据。 Then click Activate.然后点击激活。

After your JetBrains account is linked, you should see a new Gears icon which is used to manage Settings synchronization:链接您的 JetBrains 帐户后,您应该会看到一个新的 Gears 图标,用于管理设置同步: 在此处输入图片说明

Installed plugin synchronization is handled separately from the rest of the settings.已安装的插件同步与其余设置分开处理。 You can either manually trigger plugin sync or enable silent automatic synchronization of your plugins in the background.您可以手动触发插件同步或在后台启用插件的静默自动同步。

在此处输入图片说明

More detailed instructions更详细的说明

If you are interested in more detailed instructions and explanations, you can find them it this blog post I wrote:如果您对更详细的说明和解释感兴趣,可以在我写的这篇博文中找到它们:

IntelliJ IDEA Tips & Tricks: Synchronization and Sharing of Settings IntelliJ IDEA 提示和技巧:同步和共享设置

You can use the new Settings Sync plugin that has just been released.您可以使用刚刚发布的新设置同步插件。 It lets you sync UI and editor settings, keymaps, and the list of enabled and disabled plugins across all IntelliJ-platform-based IDEs.它允许您在所有基于 IntelliJ 平台的 IDE 中同步 UI 和编辑器设置、键盘映射以及启用和禁用的插件列表。 https://plugins.jetbrains.com/plugin/9922-ide-settings-sync https://plugins.jetbrains.com/plugin/9922-ide-settings-sync

2021 new feature: 2021年新功能:

File -> Manage IDE Settings -> Sync Settings to JetBrains Account File -> Manage IDE Settings -> 将Sync Settings to JetBrains Account

It takes care of the sync for you in the background to all your JetBrains IDEs, hands free.它会在后台为您处理所有 JetBrains IDE 的同步,免提。

在此处输入图片说明

I was able to transfer settings from PyCharm Professional 2020.2.2 to IntelliJ IDEA Ultimate 2020.2.2 like so:我能够将设置从 PyCharm Professional 2020.2.2 传输到 IntelliJ IDEA Ultimate 2020.2.2,如下所示:

In PyCharm I selected File > Manage IDE Settings > Export Settings and exported a settings.zip archive.在 PyCharm 中,我选择了File > Manage IDE Settings > Export Settings并导出了settings.zip存档。 In IntelliJ I selected File > Manage IDE Settings > Import Settings and imported this archive.在 IntelliJ 中,我选择了File > Manage IDE Settings > Import Settings并导入了这个存档。 IntelliJ told me the import was successful. IntelliJ 告诉我导入成功。

This does the trick as far as I can tell, but I wouldn't be surprised if this doesn't work for all JetBrains IDE pairs.据我所知,这可以解决问题,但如果这不适用于所有 JetBrains IDE 对,我也不会感到惊讶。

You can copy over the things in codestyles folders: http://www.jetbrains.com/idea/webhelp/copying-code-style-settings.html您可以复制codestyles文件夹中的内容: http : //www.jetbrains.com/idea/webhelp/copying-code-style-settings.html

I haven't explored other settings, though - but a quick diff is telling me that colors folder is probably completely compatible.不过,我还没有探索其他设置 - 但是一个快速的差异告诉我colors文件夹可能完全兼容。 You might even be able to get away with symlinking?你甚至可以摆脱符号链接?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM