Is there any shortcut key to align code in Geany editor?

Am using Geany editor in ubuntu 13.10, Is there any shortcut key to align code (auto-alignment) in Geany editor?

For example : in Eclipse - Ctrl+Shift+F to invoke the Auto Formatter


For C, C++, C++/CLI, C#, and Java

You can achieve a similar behavior with Artistic Style 2.04.

  1. Download the newest version, current 2.04 (do not use apt-get to install because then you will get the older version 2.03 and this version will not work for this scenario because it do not accept piped output)

  2. Install Artistic Style -> follow the install doc (/astyle/doc/install.html) in the download (make then make install)

  3. Add a custom command to Geany:

    enter image description here

    enter image description here

    bash -c "astyle --indent-classes -Y"

    To customize this look at the Artistic Style documentation

  4. Select an text area and press Ctrl+1 to run the first Geany custom command

    enter image description here

For HTML

You can use tidy, tidy can also compile your html code if you use geany.

  1. Install tidy: sudo apt-get install tidy

  2. Create a custom command (example):

    bash -c "tidy -xml --indent auto --indent-spaces 2 --quiet yes 2> /dev/null; true"

More info:

  • Use HTML Tidy to just indent HTML code?
  • Clean up your Web pageswith HTML TIDY
  • tidy man page
  • tidy Quick Reference

For Python

Python Source Formatter/Pretty Printer (not tested)


For XML Go to Tools>Plugin manager and activate the plugin called XML PrettyPrinter. If that plugin is not available then search for it using apt or synaptic.

Once install, run by clicking Tools>PrettyPrinter XML.