blob: cde504d9ca3a8cd01816a808ccdf4dc9dd56efb4 [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>
Luca Saccarolaa5d19aa2025-01-29 10:27:55 +01004" Last Change: 2025 Jan 29
Luca Saccarolaa13bd292024-11-19 20:43:52 +01005
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
Luca Saccarolaa5d19aa2025-01-29 10:27:55 +010024syn match hyprString "'[^']*'" contained
25syn match hyprString '"[^"]*"' contained
Luca Saccarolaa13bd292024-11-19 20:43:52 +010026syn match hyprColor 'rgb(\(\w\|\d\)\{6})' contained
27syn match hyprColor 'rgba(\(\w\|\d\)\{8})' contained
28syn match hyprColor '0x\(\w\|\d\)\{8}' contained
29syn keyword hyprBoolean true false yes no on off contained
30
31" Super Shift Alt Ctrl Control
32syn keyword hyprModifier contained
33 \ super supershift superalt superctrl supercontrol
34 \ super_shift super_alt super_ctrl super_control
35 \ shift shiftsuper shiftalt shiftctrl shiftcontrol
36 \ shift_super shift_alt shift_ctrl shift_control
37 \ alt altsuper altshift altctrl altcontrol
38 \ alt_super alt_shift alt_ctrl alt_control
39 \ ctrl ctrlsuper ctrlshift ctrlalt ctrlcontrol
40 \ ctrl_super ctrl_shift ctrl_alt ctrl_control
41 \ control controlsuper controlshift controlalt controlctrl
42 \ control_super control_shift control_alt control_ctrl
43
44" Comments
45syn match hyprComment '#.*$'
46
47" Link to default groups
48hi def link hyprVariable Identifier
49hi def link hyprCategoryD Special
50hi def link hyprComment Comment
51hi def link hyprNumber Constant
52hi def link hyprModifier Constant
53hi def link hyprFloat hyprNumber
54hi def link hyprBoolean Boolean
55hi def link hyprString String
56hi def link hyprColor Structure
57hi def link hyprCommand Keyword
58
59" vim: ts=8 sts=2 sw=2 et