Scripting the Vim editor, Part 5: Event-driven scripting and automation
<b>IBM Developerworks:</b> "Why repeat yourself? You can configure Vim’s comprehensive event model to execute time-saving scripts whenever particular editing events—such as loading a file or switching between editor modes—occur."