4

When editing html in Vim, I'll write the class name of the section that I am working on like this:

mid-med

It is untagged plain text.

I'll call tcomment to comment that out. What I expect to have happen is this:

<!-- mid-med -->

Instead I get this:

<!-- mid&#45;med -->

tcomment is converting the plain-text hyphen into html character code.

Is there anyway to prevent tcomment from doing this?

I searched "help:tcomment" but I couldn't find or make sense of anything.

I could just create the comment code first then type in the text but that's counter-intuitive and messing up my workflow.

Any help would be appreciated.

Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37

2 Answers2

3

Add this to a file ~/.vim/ftplugin/html.vim:

let g:tcomment#replacements_xml = {}
Sato Katsura
  • 4,009
  • 17
  • 24
  • That do solves the problem but could you detail a little more your answer to explain why it works please? :-) – statox Oct 09 '15 at 06:52
  • 1
    @statox Not really. It works because the code uses g:tcomment#replacements_xml for translations. Now, why does the code do that for HTML files, is a good question. A question you'd have to ask tcomment's author though. Personally I suspect it's a bug, but the author might disagree. :) – Sato Katsura Oct 09 '15 at 07:12
  • my pwd was "~/.vim/bundle/html5.vim/ftplugin/html.vim". Solution worked like a charm. Thank you – Derek Dakan Oct 09 '15 at 17:19
0

Just updating the answers to this question, as I encountered this annoyance and I found a solution.

Edit ~/.vim/bundle/tcomment_vim/autoload/tcomment.vim (line ~152):

                "\     '-': '&#45;',
                "\     '&': '&#38;',
                \     '-': '-',
                \     '&': '&',

I.e., simply replace - with - ...

Restart Vim.

Details here: https://github.com/tomtom/tcomment_vim/issues/253

enter image description here