Vim seemed to not working properly when I remotely connected my mac with Berkeley’s remote machine. My mac has OS X Mountain Lion 10.8.3 and I connected to a server running Solaris 10. When I was editing a file using Vim, the arrow keys printed “A”, “B”, “C”, “D” and delete key simply did nothing. And after a short time of search I found this works for me and hopefully this can help you too.
First go to the root directory of the remote machine: 
cd /
Then create a new Vim config file .vimrc
vim .vimrc
Add these two lines to this file to correct arrow keys and delete key behavior.
:set nocompatible
:set backspace=start,eol,indent
And that’s it, it works for me and if there is any better solution I’m happy to know!
