Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Html/XML commenting #65

Open
szebenyib opened this issue Mar 1, 2016 · 2 comments
Open

Html/XML commenting #65

szebenyib opened this issue Mar 1, 2016 · 2 comments

Comments

@szebenyib
Copy link

Hi!

Would it be possible to escape existing comments in html/xml differently than it is implemented now?
The problem is that the generated xml code is invalid if comments already exist in the file, because -- characters in a commented part are invalid.

Example:
<!-- something -->
becomes
<!-- <1-- something --1> -->

It would be nice if the following happened:
Example:
<!-- something -->
becomes
<!-- <1__ something __1> -->

This renders the page invalid and invalidity completely denies rendering of the file.

@5202
Copy link

5202 commented Apr 10, 2016

@szebenyib
Same problem here, vim-commentary is great, but for xml a little bit useless because of not-valid nested-comments. I wrote a small workaround, maybe it is helpfull!

augroup Xml
command! ValidComment execute "normal! mtvat\<esc>`<:'<,'>s/<1!--/<1!__/ge\<cr>:'<,'>s/--1>/__1>/ge\<cr>:nohlsearch\<cr>"
command! ValidUncomment execute "normal! mtvat\<esc>`<:'<,'>s/<1!__/<!--/ge\<cr>:'<,'>s/__1>/-->/ge\<cr>:nohlsearch\<cr>"
nnoremap <leader>vc :ValidComment<cr>
nnoremap <leader>vu :ValidUncomment<cr>
augroup END

@tpope
Sorry for my bad knowledge of VimL, I'm just a beginner with Vim, I'm sure there is a better solution!

@vrkansagara
Copy link

@tpope I appreciate if you provide commentstring for xml.

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

No branches or pull requests

3 participants