mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Explicitly check for cterm and gui values for fg
If a user hasn't set either we default to NONE
This commit is contained in:
parent
c817b62ae4
commit
19c9465a8c
1 changed files with 8 additions and 7 deletions
|
|
@ -11,17 +11,18 @@ let g:loaded_nvim_treesitter = 1
|
||||||
|
|
||||||
lua require'nvim-treesitter'.setup()
|
lua require'nvim-treesitter'.setup()
|
||||||
|
|
||||||
function s:has_attr(attr)
|
function s:has_attr(attr, mode)
|
||||||
return strlen(synIDattr(hlID('Normal'), a:attr)) > 0
|
let norm_color = synIDattr(hlID('Normal'), a:attr, a:mode)
|
||||||
|
return strlen(norm_color) > 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" if the ctermfg or guifg is not known by nvim then using the
|
" if the ctermfg or guifg is not known by nvim then using the
|
||||||
" fg or foreground highlighting value will cause an E419 error
|
" fg or foreground highlighting value will cause an E419 error
|
||||||
if s:has_attr('fg')
|
" so we check to see if either highlight has been set if not default to NONE
|
||||||
highlight default TSNone term=NONE cterm=NONE gui=NONE guifg=foreground ctermfg=fg
|
let cterm_normal = s:has_attr('fg', 'cterm') ? 'fg' : 'NONE'
|
||||||
else
|
let gui_normal = s:has_attr('fg', 'gui') ? 'foreground' : 'NONE'
|
||||||
highlight default TSNone term=NONE cterm=NONE gui=NONE
|
|
||||||
endif
|
execute 'highlight default TSNone term=NONE cterm=NONE gui=NONE guifg='.gui_normal.' ctermfg='.cterm_normal
|
||||||
|
|
||||||
highlight default link TSError TSNone
|
highlight default link TSError TSNone
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue