Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Stephan Walter <stephan <at> walter.name>
Subject: Showing "age" of code lines in Gvim
Newsgroups: gmane.comp.version-control.mercurial.general
Date: Saturday 10th November 2007 22:47:40 UTC (over 10 years ago)
Hi,

I recently read a blog post by someone (forgot the name) suggesting to
use code highlighting for showing other things than syntax. One example
was to show code age, i.e. which revision a line of code belongs to.
This could be useful to find a newly introduced bug by having a visual
indication of the age of each line.

I put together a quick-and-dirty vim script to do this, using "hg
annotate" and misusing the syntax highlighting in gvim.

"before" screenshot (i.e. normal Python syntax highlighting):
http://stephan.walter.name/files/hgage/before.png

"after" screenshot:
http://stephan.walter.name/files/hgage/after.png

The script is here:
http://stephan.walter.name/files/hgage/hgage.vim

Usage is very simple: just do ":source hgage.vim". It will do the
colorization for the file in the current buffer.

Caveats:
* no error checking
* wrap-around of colors if there are more than  16 different revisions.
* works on background color, but most foreground colors are lost. wtf?
* no undo, you have to reload the file
* will not update if you edit the file

To any Vim wizards: Feel free to improve the script!

Greetings,
Stephan Walter
 
CD: 4ms