Vim Tips Wiki
(Move categories to tip template)
(Remove html character entities)
Line 15: Line 15:
   
 
<pre>
 
<pre>
:map &lt;F5&gt; /\/\/&lt;enter&gt;xxi/*&lt;esc&gt;A*/&lt;esc&gt;
+
:map <F5> /\/\/<CR>xxi/*<Esc>A*/<Esc>
 
</pre>
 
</pre>
   
This will do the action per found line. Start at the beginning of the file, and repeatedly press &lt;F5&gt; (or whatever key you use) untill an error message occurs.
+
This will do the action per found line. Start at the beginning of the file, and repeatedly press <F5> (or whatever key you use) untill an error message occurs.
   
 
==Comments==
 
==Comments==

Revision as of 23:44, 29 September 2008

Tip 1010 Printable Monobook Previous Next

created October 6, 2005 · complexity basic · author Frans · version 5.7


Our current development requires everything to be MISRA compliant. One of the MISRA rules is: //-style-comments are not acceptable. These occurrences must be replaced by /*-style-comments-*/. The following mapping will do this per line.

:map <F5> /\/\/<CR>xxi/*<Esc>A*/<Esc>

This will do the action per found line. Start at the beginning of the file, and repeatedly press <F5> (or whatever key you use) untill an error message occurs.

Comments

This will help you:

%s,//\(.*\),/*\1 */,