blob: f36c58c646b4f2c57d36f26ffa1f0aa07b4a35b2 [file] [log] [blame]
Luca Saccarolaa13bd292024-11-19 20:43:52 +01001" Vim syntax file
2" Language: hyprlang
3" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
4" Last Change: 2024 nov 15
5
6if exists("b:current_syntax")
7 finish
8endif
9let b:current_syntax = "hyprlang"
10
11syn case ignore
12
13syn match hyprCommand '^\s*\zs\S\+\ze\s*=' contains=hyprVariable
14syn match hyprValue '=\s*\zs.\+\ze$' contains=hyprNumber,hyprFloat,hyprBoolean,hyprString,hyprColor,hyprModifier,hyprVariable,hyprComment
15
16syn match hyprVariable '\$\w\+' contained
17
18" Category
19syn region hyprCategory matchgroup=hyprCategoryD start='^\s*\k\+\s*{' end='^\s*}' contains=hyprCommand,hyprValue,hyprComment,hyprCategory,hyprCategoryD
20
21" Variables Types
22syn match hyprNumber '\%[-+]\<\d\+\>\%[%]' contained
23syn match hyprFloat '\%[-+]\<\d\+\.\d\+\>\%[%]' contained
24syn match hyprString '["\'].*["\']' contained
25syn match hyprColor 'rgb(\(\w\|\d\)\{6})' contained
26syn match hyprColor 'rgba(\(\w\|\d\)\{8})' contained
27syn match hyprColor '0x\(\w\|\d\)\{8}' contained
28syn keyword hyprBoolean true false yes no on off contained
29
30" Super Shift Alt Ctrl Control
31syn 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
44syn match hyprComment '#.*$'
45
46" Link to default groups
47hi def link hyprVariable Identifier
48hi def link hyprCategoryD Special
49hi def link hyprComment Comment
50hi def link hyprNumber Constant
51hi def link hyprModifier Constant
52hi def link hyprFloat hyprNumber
53hi def link hyprBoolean Boolean
54hi def link hyprString String
55hi def link hyprColor Structure
56hi def link hyprCommand Keyword
57
58" vim: ts=8 sts=2 sw=2 et