Vim Tips Wiki

Insert comment boxes in your code

Revision as of 04:53, April 25, 2008 by JohnBot (Talk | contribs)

1,619pages on
this wiki
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


  • 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.


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