Vim formatting goodness

Posted on Wed 20 June 2012 in misc

So I wanted to paste this licence into my piece of code http://www.opensource.org/licenses/bsd-license.php

But I wanted it be wrapped to no more than  79 characters a line and before each sentence I wanted to insert a "# "

This is how

:set paste (paste text from web browser)
highlight area with shift V

! fmt -77 (keep 2 characters for "\# ")
s!\^!\# !

Love it!

vim