Auto Allman-style Braces in Komodo

komodo ide blog hero

Macro Monday – a new macro to dig into every Monday!

Komodo does not dictate any sort of coding style, it merely facilitates you to
code whichever way you want. It’s easy to code in Allman style, but we can make
it even easier with a simple macro.
Essentially what this macro does is turn;


Typing speed aside in these gifs, the productivity gain here is one less keypress.
It won’t make a huge difference but it’s the little things that make you more
In case it’s not clear what is happening in those gifs, normally when you would
want to write in allman step you would essentially go through the following steps

while (0)

The second I type the opening brace Komodo auto completes it to

while (0)

Where “|” represents the cursor. Then when I press enter I get:

while (0)

This works great, but we can make it even shorter (without resorting to snippets), what if I could just write the following

while (0) {

And the second I type the opening brace it auto-completes to Allman style indentation?
That is basically what this macro does.
Currently this macro is still very experimental and will likely have a few bugs
that need to be worked out. Hopefully we’ll be able to include it as a native
feature in Komodo 9.


To install the macro simply hit the “View Resource” and “Install Instructions”
links below. You’ll want to hook the macro up to the “On Startup” trigger.



Simply start typing! Provided that you have triggered the macro (either via the
startup event or by manually invoking it) it will automatically complete your
curly braces to Allman style.


Thanks to @woodpile from the Komodo Forums for pointing out the use-case for this functionality!

Recent Posts

Webinar - Securing Python and Open Source Ecosystems
Securing Python and Open Source Ecosystems

Dustin Ingram, Fellow at the Python Software Foundation (PSF), joins us to discuss trust and security for PyPI and other repositories in light of recent supply chain attacks, and steps being taken to secure the open source ecosystem.

Read More
Scroll to Top