Extend of this question of fold: Fold: foldtext() for each filetype
We have fold for each filetype now but each fold need different highlight style of color, because
highlight is global I tried to set it in
after/ftplugin/rust/folding.vim and then reset it back to my favor default one but it doesn't effect.
Inconsistent behavior like if vim enter buffer of rust it set to new
hi and then if leave
rust buffer file it still persist the rust's
hi for other buffers, that is not expected, leave
rust buffer should set
hi back to default and other buffers should take the default one instead of the new rust
if exists('b:undo_ftplugin') let b:undo_ftplugin .= ' | ' else let b:undo_ftplugin = '' endif " set highlight here for this specific fold hi Fold ctermfg=10 ctermbg=12 " This is where my local foldtext() function for rust.vim foldtext() <...> if !exists("*MyRustFtpluginUndo") function MyCFtpluginUndo() setlocal tags< setlocal path< silent! nunmap <buffer> <LocalLeader>tr " set highlight back to default one hi Fold ctermfg=5 ctermbg=6 endfunction endif let b:undo_ftplugin .= 'call MyRustFtpluginUndo()'
hi Fold ctermfg=10 ctermbg=12 and
hi Fold ctermfg=5 ctermbg=6