Wikia

Vim Tips Wiki

Changes: Insert comment boxes in your code

Edit

Back to page

(Move categories to tip template)
(Remove html character entities)
 
Line 15: Line 15:
   
 
<pre>
 
<pre>
map ,co O#====================================================================================================&lt;CR&gt;#&lt;CR&gt;#====================================================================================================&lt;ESC&gt;100\|Dkk100\|DjA
+
map ,co O#====================================================================================================<CR>#<CR>#====================================================================================================<Esc>100\|Dkk100\|DjA
 
</pre>
 
</pre>
   
Line 29: Line 29:
   
 
<pre>
 
<pre>
map ,co O#&lt;ESC&gt;100A=&lt;ESC&gt;100\|D&lt;CR&gt;i#&lt;CR&gt;&lt;ESC&gt;i##&lt;ESC&gt;100a=&lt;ESC&gt;100\|D&lt;ESC&gt;kA
+
map ,co O#<Esc>100A=<Esc>100\|D<CR>i#<CR><Esc>i##<Esc>100a=<Esc>100\|D<Esc>kA
 
</pre>
 
</pre>
   

Latest revision as of 23:27, September 29, 2008

Tip 900 Printable Monobook Previous Next

created March 22, 2005 · complexity intermediate · author Ken Holm · version 5.7


Put this in your vimrc and you can have nicely aligned comment boxes:

map ,co O#====================================================================================================<CR>#<CR>#====================================================================================================<Esc>100\|Dkk100\|DjA

Note:

  • The above should all be on one line.
  • There is a space after the "A" at the end of the line above.
  • While in navigation mode use ,co to create a comment block.
  • The comment block will chop off at column 100.
  • It relies on having autoindent set.

CommentsEdit

This should have the same result, I believe:

map ,co O#<Esc>100A=<Esc>100\|D<CR>i#<CR><Esc>i##<Esc>100a=<Esc>100\|D<Esc>kA

Around Wikia's network

Random Wiki