Reputation: 73
some javascript codes embedded in html as below:
commented with the vim plugin NERD_Commenter
<body>
<script language="javascript">
<!--alert("hello word");-->
<!--alert("hello word");-->
<!--alert("hello word");-->
<!--alert("hello word");-->
</script>
</body>
I'd like the inner javascript codes commented in a style below:
<script language="javascript">
//alert("hello word");
//alert("hello word");
//alert("hello word");
//alert("hello word");
</script>
How to deal with it? Or is there a better plugin for code commenting?
Upvotes: 5
Views: 334
Reputation: 31110
You can use tcomment.vim. That's what I use and it supports some mixed language highlighting (demo). For example you can use gc<motion>
to comment text or gcc
to comment a line and it will usually detect the language appropriately.
Upvotes: 1