From 4c85c217d384c79013401f09b329467c53c8a01c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Nov 2024 22:30:50 +0100 Subject: vim-patch:9.1.0875: filetype: hyprlang detection can be improved Problem: filetype: hyprlang detection can be improved Solution: detect '/hypr/*.conf' files as hyprlang filetype, include basic syntax highlighting (Luca Saccarola) fixes: vim/vim#15875 closes: vim/vim#16064 https://github.com/vim/vim/commit/a13bd294ab2d9ab38634c9ec51fa76205af6eb62 Co-authored-by: Luca Saccarola --- runtime/syntax/hyprlang.vim | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 runtime/syntax/hyprlang.vim (limited to 'runtime/syntax/hyprlang.vim') diff --git a/runtime/syntax/hyprlang.vim b/runtime/syntax/hyprlang.vim new file mode 100644 index 0000000000..f36c58c646 --- /dev/null +++ b/runtime/syntax/hyprlang.vim @@ -0,0 +1,58 @@ +" Vim syntax file +" Language: hyprlang +" Maintainer: Luca Saccarola +" Last Change: 2024 nov 15 + +if exists("b:current_syntax") + finish +endif +let b:current_syntax = "hyprlang" + +syn case ignore + +syn match hyprCommand '^\s*\zs\S\+\ze\s*=' contains=hyprVariable +syn match hyprValue '=\s*\zs.\+\ze$' contains=hyprNumber,hyprFloat,hyprBoolean,hyprString,hyprColor,hyprModifier,hyprVariable,hyprComment + +syn match hyprVariable '\$\w\+' contained + +" Category +syn region hyprCategory matchgroup=hyprCategoryD start='^\s*\k\+\s*{' end='^\s*}' contains=hyprCommand,hyprValue,hyprComment,hyprCategory,hyprCategoryD + +" Variables Types +syn match hyprNumber '\%[-+]\<\d\+\>\%[%]' contained +syn match hyprFloat '\%[-+]\<\d\+\.\d\+\>\%[%]' contained +syn match hyprString '["\'].*["\']' contained +syn match hyprColor 'rgb(\(\w\|\d\)\{6})' contained +syn match hyprColor 'rgba(\(\w\|\d\)\{8})' contained +syn match hyprColor '0x\(\w\|\d\)\{8}' contained +syn keyword hyprBoolean true false yes no on off contained + +" Super Shift Alt Ctrl Control +syn keyword hyprModifier contained + \ super supershift superalt superctrl supercontrol + \ super_shift super_alt super_ctrl super_control + \ shift shiftsuper shiftalt shiftctrl shiftcontrol + \ shift_super shift_alt shift_ctrl shift_control + \ alt altsuper altshift altctrl altcontrol + \ alt_super alt_shift alt_ctrl alt_control + \ ctrl ctrlsuper ctrlshift ctrlalt ctrlcontrol + \ ctrl_super ctrl_shift ctrl_alt ctrl_control + \ control controlsuper controlshift controlalt controlctrl + \ control_super control_shift control_alt control_ctrl + +" Comments +syn match hyprComment '#.*$' + +" Link to default groups +hi def link hyprVariable Identifier +hi def link hyprCategoryD Special +hi def link hyprComment Comment +hi def link hyprNumber Constant +hi def link hyprModifier Constant +hi def link hyprFloat hyprNumber +hi def link hyprBoolean Boolean +hi def link hyprString String +hi def link hyprColor Structure +hi def link hyprCommand Keyword + +" vim: ts=8 sts=2 sw=2 et -- cgit From 718e9ce018572f609a7639865af55476a19847aa Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Feb 2025 17:13:42 +0800 Subject: vim-patch:a5d19aa: runtime(hyprlang): fix string recognition (#32290) fixes: vim/vim#16064 closes: vim/vim#16527 https://github.com/vim/vim/commit/a5d19aa44d97151d572362a24efccbfa09d560ae Co-authored-by: Luca Saccarola --- runtime/syntax/hyprlang.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/syntax/hyprlang.vim') diff --git a/runtime/syntax/hyprlang.vim b/runtime/syntax/hyprlang.vim index f36c58c646..cde504d9ca 100644 --- a/runtime/syntax/hyprlang.vim +++ b/runtime/syntax/hyprlang.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: hyprlang " Maintainer: Luca Saccarola -" Last Change: 2024 nov 15 +" Last Change: 2025 Jan 29 if exists("b:current_syntax") finish @@ -21,7 +21,8 @@ syn region hyprCategory matchgroup=hyprCategoryD start='^\s*\k\+\s*{' end='^\s*} " Variables Types syn match hyprNumber '\%[-+]\<\d\+\>\%[%]' contained syn match hyprFloat '\%[-+]\<\d\+\.\d\+\>\%[%]' contained -syn match hyprString '["\'].*["\']' contained +syn match hyprString "'[^']*'" contained +syn match hyprString '"[^"]*"' contained syn match hyprColor 'rgb(\(\w\|\d\)\{6})' contained syn match hyprColor 'rgba(\(\w\|\d\)\{8})' contained syn match hyprColor '0x\(\w\|\d\)\{8}' contained -- cgit