==== HCL Filetype (Terraform / OpenTofu) ===== **HCL** is a file format used to by Terraform and OpenTofu. This page describe how to add HCL file syntax highlighting to Geany. ===== Step 1) ===== Add the following lines to //~/.config/geany/filetype_extensions.conf// under the respective sections [Extensions] and [Groups] [Extensions] HCL=*.tf;*.tfvars;*.hcl; ===== Step 2) ===== Save the configuration file below in your Geany filetype definition files config directory, e.g. //~/.config/geany/filedefs/filetypes.HCL.conf// # For complete documentation of this file, please see Geany's main documentation [styling=C] preprocessor=comment [keywords] # all items must be in one line primary=data local locals module provider resource terraform var [lexer_properties=C] styling.within.preprocessor=0 [settings] # default extension used when saving files extension=tf lexer_filetype=C tag_parser=Terraform # the following characters are these which a "word" can contains, see documentation #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 # single comments, like # in this file comment_single=# #comment_single=// # multiline comments comment_open=/* comment_close=*/ # set to false if a comment character/string should start at column 0 of a line, true uses any # indentation of the line, e.g. setting to true causes the following on pressing CTRL+d #command_example(); # setting to false would generate this # command_example(); # This setting works only for single line comments comment_use_indent=true # context action command (please see Geany's main documentation for details) #context_action_cmd= [indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0 [build-menu] FT_00_LB=Plan FT_00_CM=terraform plan -no-color FT_00_WD=%d EX_00_LB=Apply EX_00_CM=terraform apply EX_00_WD=%d EX_01_LB=Destroy EX_01_CM=terraform destroy EX_01_WD=%d FT_01_LB=Init FT_01_CM=terraform init -no-color FT_01_WD=%d ===== Step 3) ===== If you are using the Geany-LSP plugin (https://plugins.geany.org/lsp.html) for additional editing assistance, you can also use the Terraform language server. The Geany-LSP plugin already includes the corresponding configuration for the filetype HCL. You only need to install the language server from https://github.com/hashicorp/terraform-ls or https://github.com/opentofu/opentofu-ls. {{tag>configure hcl terraform opentofu tfvars filetype}}