mprobst / ClangFormatIJ

clang-format for IntelliJ based IDEs
Apache License 2.0
15 stars 9 forks source link

clang-format for IntelliJ based IDEs

ClangFormatIJ hooks up clang-format into IntelliJ based IDEs, such as IntelliJ IDEA, WebStorm, or similar.

Installation

To use clang-format, please install it from the JetBrains Marketplace.

Next, you'll need to install clang-format itself. To do so, you could grab the binaries...

Once installed, go into your IntelliJ settings for clang-format (Settings > Tools > clang-format) and point the clang-format binary field to the executable (e.g. clang-format.exe on Windows).

The executable could be located in your PATH already, or you could explicitly use something like the following:

Usage

To use the formatter, simply run the Reformat Code with clang-format action inside of your IDE.

You can also bind the action to a key inside of your settings (Settings > Keymap > Reformat Code with clang-format) and even create a Macro that automatically reformats your code upon saving it.