blob: 081d917b4c401bacce989009f2aa42240c3c8cc5 [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>
Christian Brabandtf9f4e272025-03-26 19:00:15 +01004" Last Change: 2025 Mar 26
Luca Saccarolaa13bd292024-11-19 20:43:52 +01005
6if exists("b:current_syntax")
7 finish
8endif
Christian Brabandtf9f4e272025-03-26 19:00:15 +01009let s:cpo= &cpo
10set cpo&vim
11
Luca Saccarolaa13bd292024-11-19 20:43:52 +010012let b:current_syntax = "hyprlang"
13
14syn case ignore
15
16syn match hyprCommand '^\s*\zs\S\+\ze\s*=' contains=hyprVariable
17syn match hyprValue '=\s*\zs.\+\ze$' contains=hyprNumber,hyprFloat,hyprBoolean,hyprString,hyprColor,hyprModifier,hyprVariable,hyprComment
18
19syn match hyprVariable '\$\w\+' contained
20
21" Category
22syn region hyprCategory matchgroup=hyprCategoryD start='^\s*\k\+\s*{' end='^\s*}' contains=hyprCommand,hyprValue,hyprComment,hyprCategory,hyprCategoryD
23
24" Variables Types
25syn match hyprNumber '\%[-+]\<\d\+\>\%[%]' contained
26syn match hyprFloat '\%[-+]\<\d\+\.\d\+\>\%[%]' contained
Luca Saccarolaa5d19aa2025-01-29 10:27:55 +010027syn match hyprString "'[^']*'" contained
28syn match hyprString '"[^"]*"' contained
Luca Saccarolaa13bd292024-11-19 20:43:52 +010029syn match hyprColor 'rgb(\(\w\|\d\)\{6})' contained
30syn match hyprColor 'rgba(\(\w\|\d\)\{8})' contained
31syn match hyprColor '0x\(\w\|\d\)\{8}' contained
32syn keyword hyprBoolean true false yes no on off contained
33
34" Super Shift Alt Ctrl Control
35syn 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
48syn match hyprComment '#.*$'
49
50" Link to default groups
51hi def link hyprVariable Identifier
52hi def link hyprCategoryD Special
53hi def link hyprComment Comment
54hi def link hyprNumber Constant
55hi def link hyprModifier Constant
56hi def link hyprFloat hyprNumber
57hi def link hyprBoolean Boolean
58hi def link hyprString String
59hi def link hyprColor Structure
60hi def link hyprCommand Keyword
61
Christian Brabandtf9f4e272025-03-26 19:00:15 +010062let &cpo = s:cpo
63unlet s:cpo
Luca Saccarolaa13bd292024-11-19 20:43:52 +010064" vim: ts=8 sts=2 sw=2 et