tomtom / tcomment_vim

An extensible & universal comment vim-plugin that also handles embedded filetypes

Home Page:http://www.vim.org/scripts/script.php?script_id=1173

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to add custom syntax substitution

andbar-ru opened this issue · 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?