Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unideal comment with NERD_Commenter,comment javascript embed html file

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?

like image 742
UncleBill Avatar asked Nov 13 '22 08:11

UncleBill


1 Answers

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.

like image 153
Conner Avatar answered Dec 18 '22 18:12

Conner