Vim Tips Wiki
mNo edit summary
 
(fixed "¦" and some formatting)
Line 1: Line 1:
 
 
{{review}}
 
{{review}}
 
{{Tip
 
{{Tip
Line 10: Line 9:
 
|rating=-10/10
 
|rating=-10/10
 
|text=
 
|text=
the `|' concatenate servals ex-command in one line.
+
the `<nowiki>|</nowiki>' concatenate servals ex-command in one line.
   
 
It's the key to translate // style comments to /* */ style
 
It's the key to translate // style comments to /* */ style
   
:g&#35;^s{-}//&#35;s&#35;&#35;/*&#35; | s&#35;$&#35;*/&#35;
+
:g&#35;^s{-}//&#35;s&#35;&#35;/*&#35; <nowiki>|</nowiki> s&#35;$&#35;*/&#35;
   
   
   
the `|' keep the current line matchs ^s{-}// to perform s&#35;$&#35;*/
+
the `<nowiki>|</nowiki>' keep the current line matchs ^s{-}// to perform s&#35;$&#35;*/
 
 
   
 
/* ... */ ---&gt; //style
 
/* ... */ ---&gt; //style
   
:g&#35;/*(.{-})*/&#35;//1&#35;
+
:g&#35;/*(.{-})*/&#35;//1&#35;
   
 
/* ....
 
 
....
 
/* ....
+
.....
 
*/
 
....
 
 
.....
 
 
*/
 
   
 
=====&gt;
 
=====&gt;
   
//......
+
//......
 
//......
 
//......
+
//......
 
//......
 
   
 
style:
 
style:

Revision as of 09:20, 19 June 2007

Previous TipNext Tip

Tip: #35 - Translate between single line and block comments

Created: March 7, 2001 6:25 Complexity: intermediate Author: slimzhao--AT--21cn.com Version: 5.7 Karma: -10/10 Imported from: Tip#35

the `|' concatenate servals ex-command in one line.

It's the key to translate // style comments to /* */ style

:g#^s{-}//#s##/*# | s#$#*/# 


the `|' keep the current line matchs ^s{-}// to perform s#$#*/

/* ... */ ---> //style

:g#/*(.{-})*/#//1# 
/* .... 
 .... 
 ..... 
*/ 

=====>

//...... 
//...... 
//...... 

style:

? Anyone implement it?

Comments

wanted to, doesn't appear to work?

perhaps I'm no using it properly

leinfidel--AT--netscape.net , August 31, 2003 14:29