TaDaa / vimade

An eye friendly plugin that fades your inactive buffers and preserves your syntax highlighting!
MIT License
486 stars 8 forks source link

TreeSitter #73

Closed SingularisArt closed 10 months ago

SingularisArt commented 11 months ago

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?

TaDaa commented 10 months ago

There are two cases currently:

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()
SingularisArt commented 10 months ago

When I use that code, I get the following error: display-error

TaDaa commented 10 months ago

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?