我应该在我的点文件中保存哪些 IntelliJ 配置文件?

Which IntelliJ config files should I save in my dotfiles?

我想将我的 IntelliJ 配置文件保留在我的 dotfiles 存储库中,但我的 ~/.IntelliJIdea2016.1 文件夹权重 > 1.3G :(

~/.IntelliJIdea2016.1/config/ 仍然权重 > 215M...

~/.IntelliJIdea2016.1/config/plugins/ 包含很多二进制文件...不是点文件的最佳候选者:(

有人试图在没有 Export/Import settings 菜单选项的情况下保存 IntelliJ 配置吗?

无需存储IntelliJ配置文件,直接使用 IDE Settings Sync 插件。

看到这个post:Better Synchronization of your Settings Across Devices

遗憾的是,这并不简单。用户配置文件夹不是 well-documented,并且历史上包含一堆默认垃圾,这些垃圾正在慢慢被删除(参见 https://youtrack.jetbrains.com/issue/IDEA-128660 and https://youtrack.jetbrains.com/issue/IDEA-163616). The documentation of settings files is also very poor; my request for improvement was declined https://youtrack.jetbrains.com/issue/IDEA-154157)。

我对我的设置进行版本控制。如果您请求访问,您可以在 https://gitlab.com/jcrben-staples/dotfiles-group/dotfiles/tree/master/config/intellij-idea-latest with notes at https://gitlab.com/jcrben-staples/dotfiles-group/dotfiles/tree/master/config/intellij-idea-latest/MY_CONFIG_DOCS.md) 看到它。

我将 .gitignore 设置为默认忽略所有内容,然后将我想要的文件列入白名单。使用 IntelliJ,我不知道从哪里开始,所以我将整个文件夹列入白名单,然后将一堆文件列入黑名单。

我的黑名单并没有完全回答您关于 包含哪些文件的问题,但它确实让您知道要排除什么。如果我在某个时候弄清楚要包含哪些文件,我会尝试更新它,但它是插件文件等的大杂烩。

现在黑名单看起来像这样:

    # IntelliJ IDEA stuff
    .idea
    !config/intellij-idea-latest/**
    !projects/bi-idea/workspace.xml

    # statistics files
    config/intellij-idea-latest/options/statistics*
    config/intellij-idea-latest/options/feature.usage.statistics.xml
    config/intellij-idea-latest/options/usage.statistics.xml
    config/intellij-idea-latest/options/statistics.application.usages.xml

    # user files ??
    config/intellij-idea-latest/user*

    # other
    config/intellij-idea-latest/options/atlassian-ide-plugin.app.xml
    config/intellij-idea-latest/options/cachedDictionary.xml
    config/intellij-idea-latest/options/customization.xml
    # has my autobracket disable
    config/intellij-idea-latest/options/CodeGlance.xml
    # config/intellij-idea/options/editor.codeinsight.xml
    config/intellij-idea-latest/options/databaseDrivers.xml
    config/intellij-idea-latest/options/debugger.xml
    config/intellij-idea-latest/options/dimensions.xml
    config/intellij-idea-latest/options/extensionsRootType.xml
    config/intellij-idea-latest/options/filetypes.xml
    config/intellij-idea-latest/options/find.xml
    config/intellij-idea-latest/options/find.recents.xml
    config/intellij-idea-latest/options/jdk.table.xml
    config/intellij-idea-latest/options/gemmanager.xml
    config/intellij-idea-latest/options/github_settings.xml
    config/intellij-idea-latest/options/gradle.run.settings.xml
    config/intellij-idea-latest/options/extensionsRootType.xml
    config/intellij-idea-latest/options/hg.xml
    config/intellij-idea-latest/options/ignore.xml
    config/intellij-idea-latest/options/markdown.xml
    config/intellij-idea-latest/options/multimarkdown.local.xml
    config/intellij-idea-latest/options/multimarkdown.shared.xml
    config/intellij-idea-latest/options/options.xml
    config/intellij-idea-latest/options/other.xml
    config/intellij-idea-latest/options/packages.xml
    config/intellij-idea-latest/options/pomodoro.state.xml
    config/intellij-idea-latest/options/project.default.xml
    config/intellij-idea-latest/options/proxy.settings.pwd
    config/intellij-idea-latest/options/recentProjects.xml
    config/intellij-idea-latest/options/recentProjectDirectories.xml
    config/intellij-idea-latest/options/remote-servers.xml
    config/intellij-idea-latest/options/runner.layout.xml
    config/intellij-idea-latest/options/scratches.xml
    config/intellij-idea-latest/options/stubIndex.xml
    config/intellij-idea-latest/options/updates.xml
    config/intellij-idea-latest/options/usageView.xml
    config/intellij-idea-latest/options/vcs.xml
    config/intellij-idea-latest/options/window.manager.xml
    config/intellij-idea-latest/options/window.state.xml

    # turn off those auto-update messages...
    config/intellij-idea-latest/port
    config/intellij-idea-latest/plugins/*
    config/intellij-idea-latest/tasks/*
    config/intellij-idea-latest/extensions/
    config/intellij-idea-latest/jdbc-drivers/*

    # region START UNIGNORE IntelliJ
    !config/intellij-idea-latest/scratches/
    !config/intellij-idea-latest/consoles/
    config/intellij-idea-latest/consoles/.history/*

    # General settings
    # config/intellij-idea-latest/sonarlint/
    config/intellij-idea-latest/javascript/nodejs/**
    # config/intellij-idea-latest/options/editor.codeinsight.xml # has my autobracket disable
    # endregion END UNIGNORE Intellij

这留下了相当数量的未列入黑名单的文件 - 另外我有时会符号链接我的 .idea 文件并对这些设置进行版本控制,尽管 workspace.xml 有很多东西并且它一直在变化(参见 https://youtrack.jetbrains.com/issue/IDEA-163348)。

此外,请留意 "Share" 按钮,例如下面显示的示波器按钮,因为这些按钮似乎可以控制设置是否共享到配置。

设置配置最优雅的设置来自 VSCode - 希望 Jetbrains 在某些时候能解决这个问题并复制它们:

您可以 'Share settings through a settings repository' 也可以 'Share your settings with the Settings Sync plugin'。

可以在 https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html 找到更多详细信息。如果 link 过期,请在下面的评论中告诉我。