Experimental custom filetype for the Crystal language. See also the geany-crystal Git project.
Crystal isn't supported directly, so another close language has to be chosen instead. We have the choice of either Ruby or CoffeeScript, which both have their pros/cons.
This configuration is taken from the Git project (which might have a more up-to-date one), and use the CoffeeScript lexer.
It generally supports more syntax highlighting than the Ruby lexer (see the next section).
# For complete documentation of this file, please see Geany's main documentation [styling=CoffeeScript] [keywords] # all items must be in one line primary=__FILE__ __LINE__ __DIR__ ARGV macro do extend getter setter property class_setter class_getter class_property pointerof sizeof typeof def fun end in out unless begin ensure module super until break do false next rescue then when case else for include require true while loop alias class record struct enum elsif if not return yield nil secondary=abstract abort exit self initialize finalize private protected p pp print puts raise new is_a to_a to_f to_f32 to_f64 to_h to_i to_i8 to_i16 to_i32 to_i64 to_i128 to_u to_u8 to_u16 to_u32 to_u64 to_u128 to_s to_unsafe first last shift pop starts_with ends_with empty each as # types, classes globalclass=Any Array ArrayLiteral Bool BoolLiteral Bytes Char Deque Enumerable Float32 Float64 Hash Indexable Int8 Int16 Int32 Int64 Int128 NamedTuple NamedTupleLiteral Nil NilLiteral NumberLiteral Path Pointer Proc Regex RegexLiteral Set Slice StaticArray String StringLiteral Symbol SymbolLiteral Tuple TupleLiteral UInt8 UInt16 UInt32 UInt64 UInt128 [settings] lexer_filetype=CoffeeScript tag_parser=Ruby # default extension used when saving files extension=cr # MIME type mime_type=text/x-crystal # single comments, like # in this file comment_single=# # 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=sensible-browser "https://crystal-lang.org/api/latest/%s.html" [indentation] width=2 # 0 is spaces, 1 is tabs, 2 is tab & spaces type=0 [build-menu] # %f will be replaced by the complete filename # %e will be replaced by the filename without extension # (use only one of it at one time) FT_00_LB=_Build FT_00_CM=crystal build --no-color %f FT_00_WD= FT_01_LB=_Format FT_01_CM=crystal tool format --no-color %f FT_01_WD= # Run is the same as build + execute EX_00_LB=_Run EX_00_CM=crystal run %f EX_00_WD=
Another configuration is to use the Ruby lexer. It is kept here, since some may prefer.
[styling=Ruby] [keywords] primary=abstract alias as as? asm begin break case class def do else elsif end ensure enum extend false for fun if in include instance_sizeof is_a? lib macro module next nil nil? of out pointerof private protected require rescue return select self sizeof struct super then true type typeof uninitialized union unless until when while with yield identifiers=__DIR__ __FILE__ __LINE__ __END_LINE__ [lexer_properties=Ruby] [settings=Ruby] lexer_filetype=Ruby tag_parser=Ruby extension=cr [build-menu] FT_00_LB=_Build FT_00_CM=crystal build "%f" FT_00_WD= EX_00_LB=_Run EX_00_CM=crystal run "%f" EX_00_WD= EX_01_LB=_Execute EX_01_CM="./%e" EX_01_WD=
Alter your filetype_extensions.conf to add the new Crystal filetype.
[Extensions] ... Crystal=*.cr,*.ecr; ... [Groups] ... Programming=Crystal; ...