A simple walkthrough to set up a C++ formatter for the Geany editor using Artistic Style (AStyle).
Before Formatting | After Formatting |
![]() |
![]() |
-
Download and install Artistic Style from the official site:
https://astyle.sourceforge.net/ -
Extract the downloaded archive and locate the
astyle.exe
file inside the folder. -
Copy the full path to
astyle.exe
.
make sure astyle.exe included at the end of the path
-
Open Geany.
-
Go to:
Edit
→Format
→Send Selection To...
→Set Custom Command
-
Click Add and enter the following command (replace
path
with your actual path):
path --style=allman --indent=spaces=4
-
Before formatting, select the entire file with
Ctrl + A
. -
Use the custom formatter command from the
Send Selection To
menu. -
You can assign a shortcut to your formatter command:
For example, if the formatter is the first custom command, pressCtrl + 1
to run it quickly.