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

commenting in html/jsp file #9

Open
losingkeys opened this issue Mar 7, 2012 · 11 comments
Open

commenting in html/jsp file #9

losingkeys opened this issue Mar 7, 2012 · 11 comments

Comments

@losingkeys
Copy link

Is it possible to configure commentary to use // or /**/ inside <script> tags in html files and <!-- --> elsewhere? If so, it'd be nice to have this kind of thing in jsp/php/erb files as well.

@graywh
Copy link

graywh commented Mar 7, 2012

Maybe you would be interested in http://github.com/tomtom/tcomment_vim

@losingkeys
Copy link
Author

That's fairly nice; however it can't take a # like commentary, and it seems to add more mappings than commentary.

@tpope
Copy link
Owner

tpope commented Mar 9, 2012

This sounds handy, but really, really complicated to implement, and I'm pretty convinced it wouldn't be worth it for just this one use case.

@tpope
Copy link
Owner

tpope commented Mar 9, 2012

To elaborate a bit, the sole purpose of commentary is temporarily commenting out code. In the jsp/php/erb case, you can use <%# %> comments (or whatever) to comment out HTML, JavaScript, and CSS just fine, even if it is a bit uglier. So I'm not worried about that. It's just JavaScript within plain HTML that's the use case.

Also, I'd argue that dumping big chunks of JavaScript directly into an HTML document is poor form, but that's just my opinion, not commentary's.

@suy
Copy link

suy commented Jun 7, 2013

I wrote a small plugin that piggybacks on the syntax highlighting groups to automatically change the value of commentstring. So far seems to work well for me, and it's really simple and customizable (or so I hope, my knowledge of VimL is pretty small).

I hope @tpope can give it a look, since I mostly wrote it for being used with commentary, and I really want to learn more vim script. :-) Feel free to be blunt!

https://github.com/suy/vim-context-commentstring

@Asheq
Copy link

Asheq commented May 7, 2018

For the benefit of others who come across this issue: In Issue #60, @vheon has some solutions, most notably inline_edit.vim

@robertjk
Copy link

robertjk commented May 23, 2018

The other use case is Vue.js single file components which have JavaScript, HTML and CSS all in one file (with .vue extension). I'm working on them now and have problems with commenting stuff using this plugin.

caw plugin uses something called context filetype.

@MartMcMahon
Copy link

@robertjk I came here for the same reason.
@suy 's plugin worked perfectly out of the box!

@hp4k1h5
Copy link

hp4k1h5 commented Feb 7, 2020

The other use case is Vue.js single file components which have JavaScript, HTML and CSS all in one file (with .vue extension). I'm working on them now and have problems with commenting stuff using this plugin.

i believe suy's plugin works for this now
thanks suy!

@himat
Copy link

himat commented Jun 28, 2020

@robertjk do you think caw is better than this plugin for commenting? I'm wondering which one to use.

@robertjk
Copy link

robertjk commented Jun 29, 2020

@himat I'm using vim-commentary right now. caw felt too complicated for me. This plugin is super simple and does everything I need other than context comments. caw on the other hand has context comments, but other than that does the same than this plugin only using a lot more commands and keybindings which I found overcomplicated.

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

9 participants