I’m trying to make a comment plugin , e.g when you press / for twice , it will replace the head of the line with , e.g #.
But for HTML page , it was different , since it contains both tags and javascript , I will need to surround the block with /* */ for javascript blocks , but <!-- --> for tags , but how can I know if it’s javascript block or just tags ? For now i’m merely judging this with &filetype variable , but that’s not enough.
There’s a vim plugin called
TComment. It’s what you want.You can view the source code: https://github.com/jmartindf/vim-tcomment