ClangFormatIJ hooks up clang-format into IntelliJ based IDEs, such as IntelliJ IDEA, WebStorm, or similar.
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...
npm i -g clang-format
brew install clang-format
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:
<your username>
\AppData\Roaming\npm.\node_modules\clang-format\bin\win32\clang-format.exe[path/to/clang]
/clang/bin/clang-formatTo 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.