Open losingkeys opened 12 years ago
Maybe you would be interested in http://github.com/tomtom/tcomment_vim
That's fairly nice; however it can't take a # like commentary, and it seems to add more mappings than commentary.
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.
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.
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!
For the benefit of others who come across this issue: In Issue #60, @vheon has some solutions, most notably inline_edit.vim
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.
@robertjk I came here for the same reason. @suy 's plugin worked perfectly out of the box!
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!
@robertjk do you think caw is better than this plugin for commenting? I'm wondering which one to use.
@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.
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.