Wednesday 20 June 2012

Vim formatting goodness

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!

Wednesday 13 June 2012

Listing all available package versions with yum

Sometime I needs to install an older flavour of a package.  You can list these with yum and install a specific version, e.g.

yum --showduplicates list mod_ssl
yum install mod_ssl-2.2.3-53.el5