Here's something a little more complicated, which may or may not be more useful:
http://jeffkreeftmeijer.com/2012/relative-line-numbers-in-vi...