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