It is possible in Emacs to define abbrevs based on the contents of the buffer. Sophisticated templates can be defined using the Emacs abbreviation facilities. See Abbreviations in The GNU Emacs Manual, for details.
Emacs also provides Dynamic Abbreviations. Given a partial word, Emacs
will search the buffer to find an extension for this word. For instance,
one can type ‘Abbreviations’ by typing ‘A’, followed by a keystroke
that completed the ‘A’ to ‘Abbreviations’. Repeated typing
will search further back in the buffer, so that one could 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.
Facilities like this make Vi’s :ab command obsolete.