Custom word set for autocomplete in Geany

This is a super simple guide to customizing the Geany. Here we go over adding your custom word set to a tags file so that they show up in the autocomplete.

Step 1

First of all create a tags file as below and save it as filetype.filetype.tags - for eg: I saved mine as txt.txt.tags in ~/.config/geany/tags/ directory.

  • Note: For Windows: “%USERPROFILE%\AppData\Roaming\geany\tags\txt.txt.tags”

Format for the tags file is as below.

# format=pipe 
alpha||| 
omega||| 
gamma||| 
delta||| 

Step 2

Then modify the ~/.config/geany/filetype_extensions.conf as below and add the new extension as needed to [Extensions] and if you wish add the type of file to [Groups]. That is where it will show in the menu.

  • Note: For Windows: “C:\Program Files (x86)\Geany\data\filetype_extensions.conf”
[Extensions]
...
txt=*.txt;

[Groups]
...
Misc=JSON;txt;

Step 3

Copy a system file from global directory: For eg: cp /usr/share/geany/filetypes.css ~/.config/geany/filedefs/filetypes.txt.conf

  • Note: For Windows(within admin cmd):
    copy "C:\Program Files (x86)\Geany\data\filedefs\filetypes.css" "C:\Program Files (x86)\Geany\data\filedefs\filetypes.txt.conf"

Now we need to modify this to declare and setup new file type. In my case I created a simple text/plain type. But you can choose your custom type.

[styling]
default=default
.....
[keywords]

[settings]
extension=txt
tag_parser=COBOL 

# MIME type
mime_type=text/plain
[indentation]

Did you notice that overall all we did was create a tags file with our custom words, then created a new file type and declared it's extension and tag_parser etc. Also note that I used tag_parser as COBOL even though my text has nothing to do with COBOL. It is because of a limitation in the tags parsing in Geany. I was stumped here but thanks to the open source culture, Colomban on the Geany mailing list suggested to use any unused tag_parser to the [settings].

Once all this is done, close the Geany and reopen.

  • Note: For Windows: After restarting Geany if any *.txt were auto loaded from a previous session, you will need to close and reopen these files in order for the autocomplete to work.

If you start Geany from command line as “geany -v”, you should see the following or something similar. Geany-INFO: Loaded /home/myuser/.config/geany/tags/txt.txt.tags (txt), 342 symbol(s).

Have fun. Sree

Print/export