I did something similar with DOS Paradox of all things.
Back when I used vi (first year of school) I worked for my dad's radio station over the summer building a song rotation scheduler in Paradox. Database of songs, build a list with certain rules, etc.
Paradox had a built-in editor for PAL scripts but it was pretty much garbage... except for one thing: they implemented an on-load hook that would run a PAL script.
I implemented a significant subset of vi using that on-load: search, buffers, all kinds of stuff. It was a little slow because I basically had to open up a permanent keystroke input routine and manage whether it was in insert mode or not, but man was it a lot better than just the built-in.
Regards,
-scott
Welcome to Rivendell, Mr. Anderson.