HowTos

Adding Manual or Custom Fold Points

Experienced programmers know the importance of organising our work into functions, routines and even separate 'include' files. However, there are still times when we have to write code that runs into several pages.

Geany will automatically offer fold points to sequences of comments and to functions. It can also be very useful if we can manually organise our work into sections.

To add a custom fold-point, the syntax can vary, depending on the language being used. There is a list in the Scintilla docs, here:

https://www.scintilla.org/SciTEDoc.html#property-fold.basic.comment.explicit

Remember Geany uses the good work from the Scintilla project as its foundations and Scintilla configurations can be set in the Lexer properties of your configuration.

For example, to enable explicit fold blocks in the Lexer properties section of your C code configuration, you can put the following your $HOME/.config/geany/filedefs/filetypes.c:

[lexer_properties]
fold.comment=1
fold.cpp.comment.multiline=1
fold.cpp.comment.explicit=1

Try the 'Numbered Bookmarks' plugin. This has an option to 'save the fold state'.

#!/bin/bash

{ #FB section title

# this works
# code here

}


;{(FB) 
# Ex Scintilla docs example but does NOT work
# in 'sh' as the ;'s won't parse
;} 


You may need to experiment a little …

Print/export