With this code I can quickly add and update (courtesy of Text::Reflow) flowerbox comments (for C or C++ or C#) from inside Vim. I've added set equalprg=perl\ d:\utils\equalsprg.pl to my .vimrc as a convenience. NB: code is rough, that's why it's a snippet :)

/*------------------------------- | Comments like this, similar to | | those found in crafty sources | -------------------------------*/
# Intended for use with VIM as the equalprg # Put the following line in your vimrc or <ftype>.vim # set equalprg=perl\ d:\utils\equalsprg.pl use strict; use warnings; use Text::Reflow qw/reflow_string/; my $text = join '',<>; exit unless $text; my $enteredvalue= join ' ', map { s/\s*\|\s*/ /g; # remove all pipe chars s/\/\*//g; # remove all block comment-st +art s/\*\///g; # remove all block comment-en +d s/^\s*\*//g; # remove all asterisks at sta +rt of line s/^\s*\/\///g; # remove all // at start of l +ine s/\-{5,}/ /g; # remove all strings of five +or more hyphens $_ } grep {!/^\//} grep {!/^\s*\-+\*\//} split /\n/,$text; exit unless ($enteredvalue); my $maxlen=0; my $result .= join "\n", map{"| " . substr($_ . ' 'x$maxlen, 0, $maxle +n) . " |" } map{ $maxlen = length($_) if (length > $maxle +n); $_ } # get the max line length split /\n/,reflow_string($enteredvalue); $result = '/*-'.'-'x$maxlen ."\n".$result. "\n" .' '.'-'x$maxlen ."-* +/\n"; # top and tail print $result;

In reply to flower box comments with Vim by EdwardG

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.