It is possible in Emacs to define abbrevs based on the contents of the buffer. See section `Abbreviations' in The GNU Emacs Manual, for details.
Sophisticated templates can be defined using the Emacs abbreviation facilities. Check out the `templates.el' from the Emacs archives.
Emacs also provides Dynamic Abbreviations. Given a partial word, Emacs
will search the buffer to find an extension for this word. For instance,
I typed `Abbreviations' by typing `A', followed by a keystroke
that completed the `A' to `Abbreviations'. Repeated typing
will search further, so that I get `Abbrevs' by repeating the
keystroke, which appears earlier in the text. Emacs binds this to
ESC /, so you will have to find a key and bind the function
dabbrev-expand
to that key. I use C-o for this. By using
simple keys for commands, VIP frees up a lot of other keys and key
sequences. I no longer venture outside the basic keyboard for anything.