Using clang-format in CLion

You can use External Tools in CLion.

Go to File->Settings->Tools->External Tools and click on the plus sign.

A window should pop up. Use a name of your choice.

For the Tool settings tab I’m using this configuration:

  • Program: clang-format-3.7 (you should use the name of your executable here)

  • Parameters: -i $FileName$

  • Working directory: $FileDir$

Now, with your file open, you can go to Tools->External tools and run the config above. It basically calls clang-format and does inplace formatting.

You can also set a custom keymap to it, just search the name of your external tool in “Keymap” of the Settings menu.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)