Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to add custom syntax substitution #254

Open
andbar-ru opened this issue Oct 1, 2019 · 0 comments
Open

How to add custom syntax substitution #254

andbar-ru opened this issue Oct 1, 2019 · 0 comments

Comments

@andbar-ru
Copy link

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?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant