Child pages
  • Command-Line Source Code Formatter

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Please check the official Command Line Formatter help page.

Running Command-Line Formatter when the IDE is Running

on Linux/MacOS

  • Go to <Intellij Home>/bin directory where <Intellij Home> is a directory where Intellij IDEA or Intellij IDEA-based product is installed.
  • Copy to some other file, for example,
  • Modify as follows:

    1. Uncomment the lines:
      # idea.config.path=${user.home}/.IntelliJIdea/config

      # idea.system.path=${user.home}/.IntelliJIdea/system

    2. Change them to point to some directories which differ from defaults, for example:
  • Modify by adding the line with IDEA_PROPERTIES variable:
    # ------------------------------------------------------
    # IntelliJ IDEA formatting script.
    # ------------------------------------------------------
    exec "$IDE_BIN_HOME/" format "$@"
  • Run without closing the IDE, it should give the following output:
    IntelliJ IDEA ..., build ... Formatter
    Usage: format [-h] [-r|-R] [-s|-settings settingsPath] path1 path2...
      -h|-help       Show a help message and exit.
      -s|-settings   A path to Intellij IDEA code style settings .xml file.
      -r|-R          Scan directories recursively.
      -m|-mask       A comma-separated list of file masks.
      path..         A path to a file or a directory.