tcomment_vim icon indicating copy to clipboard operation
tcomment_vim copied to clipboard

How to add custom syntax substitution

Open andbar-ru opened this issue 6 years ago • 0 comments

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?

andbar-ru avatar Oct 01 '19 16:10 andbar-ru