Table of Contents
All colour definitions and other filetype specific settings are stored in the filetype definition files. Those settings are colours for syntax highlighting, general settings like comment characters or word delimiter characters as well as compiler and linker settings.
The system-wide configuration files can be found in
$prefix/share/geany
and are called
filetypes.$ext
, where $prefix is the path where
Geany is installed (commonly
/usr/local
) and $ext is the name of the filetype.
For every filetype there is a corresponding definition file. There is one exception:
filetypes.common
- this file is for general settings, which
are not specific to a certain filetype. It is not recommended to edit the
system-wide files, because they will be overridden when
Geany is updated.
To change the settings, copy a file from $prefix/share/geany
to the subdirectory filedefs
in your configuration directory
(usually ~/.geany/
).
For example:
%
cp /usr/local/share/geany/filetypes.c /home/username/.geany/filedefs/
Then you can edit the file and the changes are also available after an update of
Geany because they reside in your configuration
directory. Alternatively, you can create a file
~/.geany/filedefs/filetypes.X
and add only these settings you
want to change. All missing settings will be read from the corresponding global
definition file in $prefix/share/geany
.
In this section the colours for syntax highlighting are defined.
The format is always:
key=forground_colour;background_colour;bold;italic
Colours have to be specified as RGB hex values prefixed by 0x. For example red is 0xff0000, blue is 0x0000ff. The values are case-insensitive, but it is a good idea to use small letters. Bold and italic are flags and should only be "true" or "false". If their value is something other than "true" or "false", "false" is assumed.
This section contains keys for different keyword lists specific to the filetype. Some filetypes do not support keywords, so adding a new key will not work. You can only add or remove keywords to/from an existing list.
The keywords list must be in one line without line ending characters.
Table 4.1. General settings
Table 4.2. Build settings
Key | Description | Example |
---|---|---|
compiler |
This item specifies the command to compile source code
files. But it is also possible to use it with
interpreted languages like Perl or Python. With these
filetypes you can use this option as a kind of syntax
parser, which sends output to the compiler message
window.
You should quote the filename to also support filenames with spaces. The following wildcards for filenames are available:
| compiler=gcc -Wall -c "%f" |
linker | This item specifies the command to link the file. If the file is not already compiled, it will be compiled while linking. The -o option is automatically added by Geany. This item works well with GNU gcc, but may be problematic with other compilers (esp. with the linker). | linker=gcc -Wall "%f" |
run_cmd | Use this item to execute your file. It has to have been built already. Use the %e wildcard to have only the name of the executable (i.e. without extension) or use the %f wildcard if you need the complete filename, e.g. for shell scripts. | run_cmd="./%e" |
There is a special filetype definition file called
filetypes.common
. This file defines some general
non-filetype-specific settings.
Table 4.3. General settings
Key | Description | Example |
---|---|---|
default | This is the default style. It is used for styling files without a filetype set. | default=0x000000;0xffffff;false;false |
selection |
The style for colouring selected text.
The format is:
| selection=0xc0c0c0;0x00007F;true;true |
brace_good | The style for brace highlighting when a matching brace was found. | brace_good=0xff0000;0xFFFFFF;true;false |
brace_bad | The style for brace highlighting when no matching brace was found. | brace_bad=0x0000ff;0xFFFFFF;true;false |
caret | The style for colouring the caret(the blinking cursor). Only the first argument is interpreted. | caret=0x000000;0x0;false;false |
caret_width | The width for the caret(the blinking cursor). Only the first argument is interpreted. The width is specified in pixels with a maximum of three pixel. Use the width 0 to make the caret invisible. | caret=1;0;false;false |
current_line | The style for colouring the background of the current line. Only the second and third arguments are interpreted. The second argument is the background colour. Use the third argument to enable or disable background highlighting for the current line (has to be true/false). | current_line=0x0;0xe5e5e5;true;false |
indent_guide | The style for colouring the indentation guides. Only the first and second arguments are interpreted. | indent_guide=0xc0c0c0;0xffffff;false;false |
white_space | The style for colouring the white space if it is shown. The first both arguments define the foreground and background colours, the third argument sets whether to use the defined foreground colour or to use the colour defined by each filetype for the white space. The fourth argument defines whether to use the background colour. | white_space=0xc0c0c0;0xffffff;true;true |
folding_style | The style of folding icons. Only first and second
arguments are used.
Valid values for the first argument are:
Valid values for the second argument are:
| folding_style=1;1;false;false |
folding_horiz_line | Draw a thin horizontal line at the line where text is
folded. Only first argument is used.
Valid values for the first argument are:
| folding_horiz_line=0;0;false;false |
invert_all | Whether to invert all defined colours. This is useful
if you like a dark background colour(e.g. black) and do
not want to change every single line. Please note, at
time of writing this was only tested with the C syntax
highlighting.
Only first argument is interpreted. Set it to 1 to invert all colours. | invert_all=0;0;false;false |