Example: Uncrustify as an external tool
Optionally, place the configuration file in the project directory (otherwise, you will need to provide the full path).
Navigate toand click .
In the dialog that opens, specify the following:
uncrustify- just for example, let's name the configuration similarly to the executable.
uncrustify- provide the binary name (and include the full path if necessary).
-c mystyle.cfg -f $FilePath$ -o $FilePath$- style settings stored in mypath.cfg will be applied to the file currently opened in the editor (the
$FileName$macro), and the result will be written in-place (the
-oflag redirects the Uncrustify output).
$FileDir$- this macro represents the current file directory.
Click Ok to save the configuration.
Now you can go toand run the tool with the above settings. The changes of code formatting will be introduced right away.
Assign a shortcut to the Uncrustify external tool:
Go to uncrustify in the list of External Tools.and find
Click and choose Add Keyboard Shortcut.
Press the keys to be used as shortcuts and click Ok.
Now the assigned shortcut is available, and you can see it next to the tool's name in themenu:
Automatically run Uncrustify before launch:
In thedialog, choose the desired run/debug configuration.
Click in the Before Launch section, and select Run External Tool:
Choose uncrustify from the list of the available external tools.
As a result, the uncrustify external tool will be called every time you choose to run or debug the selected configuration.