patch 9.1.0875: filetype: hyprlang detection can be improved Commit: https://github.com/vim/vim/commit/a13bd294ab2d9ab38634c9ec51fa76205af6eb62 Author: Luca Saccarola <github.e4...@aleeas.com> Date: Tue Nov 19 20:43:52 2024 +0100
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: #15875 closes: #16064 Signed-off-by: Luca Saccarola <github.e4...@aleeas.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 8ab97ebd8..f53e44996 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1099,8 +1099,8 @@ au BufRead,BufNewFile *.hurl setf hurl " Hyper Builder au BufNewFile,BufRead *.hb setf hb -" Hyprlang -au BufNewFile,BufRead hypr\(land\|paper\|idle\|lock\).conf setf hyprlang +" Hyprland Configuration language +au BufNewFile,BufRead */hypr/*.conf,hypr\(land\|paper\|idle\|lock\).conf setf hyprlang " Httest au BufNewFile,BufRead *.htt,*.htb setf httest diff --git a/runtime/syntax/hyprlang.vim b/runtime/syntax/hyprlang.vim new file mode 100644 index 000000000..f36c58c64 --- /dev/null +++ b/runtime/syntax/hyprlang.vim @@ -0,0 +1,58 @@ +" Vim syntax file +" Language: hyprlang +" Maintainer: Luca Saccarola <github.e4...@aleeas.com> +" 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 diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 1cd71764f..eab9d1e28 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -354,7 +354,7 @@ def s:GetFilenameChecks(): dict<list<string>> htmlm4: ['file.html.m4'], httest: ['file.htt', 'file.htb'], hurl: ['file.hurl'], - hyprlang: ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf'], + hyprlang: ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf', '/hypr/foo.conf'], i3config: ['/home/user/.i3/config', '/home/user/.config/i3/config', '/etc/i3/config', '/etc/xdg/i3/config'], ibasic: ['file.iba', 'file.ibi'], icemenu: ['/.icewm/menu', 'any/.icewm/menu'], diff --git a/src/version.c b/src/version.c index 99a145a94..ed841229f 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 875, /**/ 874, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1tDUOJ-007mWf-9i%40256bit.org.