mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Add a check to ensure the fg attribute exists
before setting the value
This commit is contained in:
parent
1e43c0267f
commit
c817b62ae4
1 changed files with 11 additions and 1 deletions
|
|
@ -11,7 +11,17 @@ let g:loaded_nvim_treesitter = 1
|
||||||
|
|
||||||
lua require'nvim-treesitter'.setup()
|
lua require'nvim-treesitter'.setup()
|
||||||
|
|
||||||
highlight default TSNone term=NONE cterm=NONE gui=NONE guifg=foreground ctermfg=fg
|
function s:has_attr(attr)
|
||||||
|
return strlen(synIDattr(hlID('Normal'), a:attr)) > 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" if the ctermfg or guifg is not known by nvim then using the
|
||||||
|
" fg or foreground highlighting value will cause an E419 error
|
||||||
|
if s:has_attr('fg')
|
||||||
|
highlight default TSNone term=NONE cterm=NONE gui=NONE guifg=foreground ctermfg=fg
|
||||||
|
else
|
||||||
|
highlight default TSNone term=NONE cterm=NONE gui=NONE
|
||||||
|
endif
|
||||||
|
|
||||||
highlight default link TSError TSNone
|
highlight default link TSError TSNone
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue