mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-08 21:14:44 +08:00
highlighter: vim9 script implementation of s:get_syn
This commit is contained in:
committed by
Christian Brabandt
parent
ae3af85ca2
commit
4d75c9940c
@@ -332,4 +332,19 @@ else
|
|||||||
return false
|
return false
|
||||||
endif
|
endif
|
||||||
enddef
|
enddef
|
||||||
|
def s:get_syn(group: string, what: string, mode: string): string # {{{2
|
||||||
|
var color = ''
|
||||||
|
if hlexists(group)
|
||||||
|
color = hlID(group)->synIDtrans()->synIDattr(what, mode)
|
||||||
|
endif
|
||||||
|
if empty(color) || str2nr(color) == -1
|
||||||
|
# Normal highlighting group should always exist
|
||||||
|
color = hlID('Normal')->synIDtrans()->synIDattr(what, mode)
|
||||||
|
# however, just in case
|
||||||
|
if empty(color) || str2nr(color) == -1
|
||||||
|
color = 'NONE'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return color
|
||||||
|
enddef
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user