I was in Ubuntu and every time I was in insert mode and hit one of the arrow keys I’d get a crazy set of control characters. Very frustrating!!!. So looking around I found this trick. Edit your .vimrc file and add the following line:
set nocompatible
That should do it. Restart vi or vim and you’re off to the races.