mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
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
a13bd294ab
Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
This commit is contained in:
parent
de9ed1ca54
commit
4c85c217d3
@ -2214,6 +2214,7 @@ local pattern = {
|
||||
['/screengrab/.*%.conf$'] = 'dosini',
|
||||
['^${GNUPGHOME}/gpg%.conf$'] = 'gpg',
|
||||
['/boot/grub/grub%.conf$'] = 'grub',
|
||||
['/hypr/.*%.conf$'] = 'hyprlang',
|
||||
['^lilo%.conf'] = starsetf('lilo'),
|
||||
['^named.*%.conf$'] = 'named',
|
||||
['^rndc.*%.conf$'] = 'named',
|
||||
|
58
runtime/syntax/hyprlang.vim
Normal file
58
runtime/syntax/hyprlang.vim
Normal file
@ -0,0 +1,58 @@
|
||||
" Vim syntax file
|
||||
" Language: hyprlang
|
||||
" Maintainer: Luca Saccarola <github.e41mv@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
|
@ -353,7 +353,7 @@ func s:GetFilenameChecks() abort
|
||||
\ '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'],
|
||||
|
Loading…
Reference in New Issue
Block a user