Luca Saccarola | a13bd29 | 2024-11-19 20:43:52 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: hyprlang |
| 3 | " Maintainer: Luca Saccarola <github.e41mv@aleeas.com> |
| 4 | " Last Change: 2024 nov 15 |
| 5 | |
| 6 | if exists("b:current_syntax") |
| 7 | finish |
| 8 | endif |
| 9 | let b:current_syntax = "hyprlang" |
| 10 | |
| 11 | syn case ignore |
| 12 | |
| 13 | syn match hyprCommand '^\s*\zs\S\+\ze\s*=' contains=hyprVariable |
| 14 | syn match hyprValue '=\s*\zs.\+\ze$' contains=hyprNumber,hyprFloat,hyprBoolean,hyprString,hyprColor,hyprModifier,hyprVariable,hyprComment |
| 15 | |
| 16 | syn match hyprVariable '\$\w\+' contained |
| 17 | |
| 18 | " Category |
| 19 | syn region hyprCategory matchgroup=hyprCategoryD start='^\s*\k\+\s*{' end='^\s*}' contains=hyprCommand,hyprValue,hyprComment,hyprCategory,hyprCategoryD |
| 20 | |
| 21 | " Variables Types |
| 22 | syn match hyprNumber '\%[-+]\<\d\+\>\%[%]' contained |
| 23 | syn match hyprFloat '\%[-+]\<\d\+\.\d\+\>\%[%]' contained |
| 24 | syn match hyprString '["\'].*["\']' contained |
| 25 | syn match hyprColor 'rgb(\(\w\|\d\)\{6})' contained |
| 26 | syn match hyprColor 'rgba(\(\w\|\d\)\{8})' contained |
| 27 | syn match hyprColor '0x\(\w\|\d\)\{8}' contained |
| 28 | syn keyword hyprBoolean true false yes no on off contained |
| 29 | |
| 30 | " Super Shift Alt Ctrl Control |
| 31 | syn keyword hyprModifier contained |
| 32 | \ super supershift superalt superctrl supercontrol |
| 33 | \ super_shift super_alt super_ctrl super_control |
| 34 | \ shift shiftsuper shiftalt shiftctrl shiftcontrol |
| 35 | \ shift_super shift_alt shift_ctrl shift_control |
| 36 | \ alt altsuper altshift altctrl altcontrol |
| 37 | \ alt_super alt_shift alt_ctrl alt_control |
| 38 | \ ctrl ctrlsuper ctrlshift ctrlalt ctrlcontrol |
| 39 | \ ctrl_super ctrl_shift ctrl_alt ctrl_control |
| 40 | \ control controlsuper controlshift controlalt controlctrl |
| 41 | \ control_super control_shift control_alt control_ctrl |
| 42 | |
| 43 | " Comments |
| 44 | syn match hyprComment '#.*$' |
| 45 | |
| 46 | " Link to default groups |
| 47 | hi def link hyprVariable Identifier |
| 48 | hi def link hyprCategoryD Special |
| 49 | hi def link hyprComment Comment |
| 50 | hi def link hyprNumber Constant |
| 51 | hi def link hyprModifier Constant |
| 52 | hi def link hyprFloat hyprNumber |
| 53 | hi def link hyprBoolean Boolean |
| 54 | hi def link hyprString String |
| 55 | hi def link hyprColor Structure |
| 56 | hi def link hyprCommand Keyword |
| 57 | |
| 58 | " vim: ts=8 sts=2 sw=2 et |