TreeSitter
SingularisArt opened this issue · comments
I'm trying to disable Treesitter for inactive buffers, but I can't seem to figure out how to do it. How did you get that working?
There are two cases currently:
vimade.enabletreesitter=0
- think this is the scenario you are interested in. Fading is performed using syntax highlighting as the baseline. Vimade overwrites TreeSitter highlights additional highlights at a higher priority usingmatchaddpos
. Syntax is off for TreeSitter, so Vimade ends up using eitherNormalNC
orNormal
for fading.vimade.enabletreesitter=1
- experimental (due to maintenance). The TreeSitter highlight tables are imported and used as the baseline instead of syntax highlighting. TreeSitter highlights are overwritten using higher prioritymatchaddpos
.
For just fading foreground text in inactive buffers for TreeSitter, something along these lines might work (NormalNC
isn't a great fit here though):
hi NormalNC guifg=#303030 ctermfg=236
function! BufEnter()
if &ft == ""
let &ft=getbufvar(bufnr(), "default_type")
endif
endfunction
function! BufLeave()
call setbufvar(bufnr(), "default_type", &ft)
set ft=
endfunction
au! BufEnter * call BufEnter()
au! BufLeave * call BufLeave()
Made a correction, BufEnter should be
function! BufEnter()
if &ft == ""
let &ft=getbufvar(bufnr(), "default_type")
endif
endfunction
nvim-treesitter-context.lua; line 308 its probably not liking the empty fileType. I haven't tried the plugin, but surprised its asserting on fileType -- does it error if just run set ft=
or set ft=randomFileType
?