14

I would like to keep my IntelliJ config files in my dotfiles repo but my ~/.IntelliJIdea2016.1 folder weights > 1.3G :(

~/.IntelliJIdea2016.1/config/ still weights > 215M...

~/.IntelliJIdea2016.1/config/plugins/ contains lots of binaries... not the best candidates for dotfiles :(

Anyone tried to save IntelliJ config without Export/Import settings menu option?

Ben Creasy
  • 3,825
  • 4
  • 40
  • 50
Cedric Thiebault
  • 1,015
  • 1
  • 15
  • 28
  • It looks like the main questions for this are https://stackoverflow.com/questions/11968531/what-to-gitignore-from-the-idea-folder and https://stackoverflow.com/questions/3041154/intellij-idea-9-10-what-folders-to-check-into-or-not-check-into-source-contro – Ben Creasy May 30 '18 at 18:15

3 Answers3

3

No need to store IntelliJ config file, just use IDE Settings Sync plugin.

See this post: Better Synchronization of your Settings Across Devices

Cedric Thiebault
  • 1,015
  • 1
  • 15
  • 28
3

Sadly, it's not simple. The user configuration folders are not well-documented and have historically included a bunch of default junk, which is slowly being stripped out (see 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).

I version control my settings. If you request access, you can see it at 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).

I set up my .gitignore to ignore everything by default, and then I whitelist the files that I want. With IntelliJ, I didn't know where to start, so I whitelisted the entire folder and then blacklisted a bunch of the files.

My blacklist doesn't exactly answer your question about what files to include, but it does give you an idea of what to exclude. I'll try to update this if I figure out which ones to include at some point, but it's a mishmash of plugin files and such.

Right now the blacklist looks something like this:

    # 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

This leaves fair number of files which are not blacklisted - plus I symlink my .idea files sometimes and version control those settings, although workspace.xml has a lot of stuff and it changes all the time (see https://youtrack.jetbrains.com/issue/IDEA-163348).

Also, keep your eye out for "Share" buttons like the one shown for a scope below, as these seem to control whether the setting is shared to a configuration.

enter image description here

The most elegant set up for settings configuration comes from VSCode - hopefully at some point Jetbrains will figure this out and copy them:

enter image description here

Ben Creasy
  • 3,825
  • 4
  • 40
  • 50
2

You can either 'Share settings through a settings repository' or you can 'Share your settings with the Settings Sync plugin'.

More details can be found at https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html. If the link ever expires please let me know in the comments below.

David
  • 4,191
  • 2
  • 31
  • 40