How to add custom syntax substitution
andbar-ru opened this issue · comments
Andrey Bartashevich commented
Sometimes tcomment doesn't know how to handle some syntax names, for instance, 'foldBraces' syntax group in typescript in *.vue files (leafgarland/typescript-vim). It comments it as html (<!-- -->) rather than typescript/javascript (//). Seemingly tcomment has global variable g:tcomment#syntax#substitute
for such cases, but I didn't find standard way to extend (not override) this variable. My method is creating file after/plugin/tcomment.vim
in .vim
directory with the following content:
" Trick to trigger tcomment's autoload.
let s:temp = g:tcomment#syntax#substitute
unlet s:temp
let g:tcomment#syntax#substitute['foldBraces'] = {'sub': 'typescript'}
Has tcomment standard method to extend substitution rules?