Search code examples
editorbracketsgeany

Auto open/close brackets in Geany


I started using Geany to programm in PHP. I noticed that, when I'm writting a condition for example (or any type of loop), when I hit the tab key right after the if or while instruction, the code finishes writing itself automatically. But the brackets don't go where I want the to go.

Here is an example to explain myself :

So this is the default behavior when I hit the tab key :

if ()
{

}

As you can see, the first bracket goes right underneath the if instruction.

But I want it to be like this :

if () {

}

How could I configure that ?


Solution

  • You can configure this via snippets.conf. Go to Tools->Configuration Files->snippets.conf. There are plenty possibilities to adjust configuration it's a good point to have a look into documentation.

    However, if I understood you correct the snippets should look something like:

    #....
    [PHP]
    if=if (%cursor%) {\n %block_cursor% \n\t}
    #....