I am editing an html file but when I invoke the NERD commenter it is adding js comments (/*...*/
) rather than html ones (<!-- ... -->
). I have just installed the latest version (2.3.0) and am using vim 7.3.
How can I fix this?
Thanks
EDIT: Digging into this more, I found in the source code of NERD_commenter.vim a list of all the supported filetypes. Oddly, xhtml and html do not appear on the list:
\ 'htmlcheetah': { 'left': '##' },
\ 'htmldjango': { 'left': '<!--','right': '-->', 'leftAlt': '{#', 'rightAlt': '#}' },
\ 'htmlos': { 'left': '#', 'right': '/#' },
I feel this cannot be right somehow. Also, bonus question: Assuming you get html comments to work, can this plugin detect when the cursor is between <script>
tags and change the comment to js comments when it is?
Digging into the NERD-commenter code, it seems that when the filetype is not in it's list, it extracts it from a vim option named &commentstring
. My guess would be that some other plugin/configurations has changed &commentstring
for html files(probably to better support javascript comments).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With