The Answer is to have to the foll entries in your ~/.exrc file
map ^[OA k
map ^[OB j
map ^[OD h
map ^[OC l
map! ^[OA ^[k
map! ^[OB ^[j
map! ^[OD ^[
map! ^[OC ^[ll
Please note, that ^[ is the ESCAPE character, which in vi can be inserted when
pressing CONTROL-V and then the ESC key (the CONTROL-V prevents vi from
believing, that you want to leave the insert mode).
The first 4 lines (map) work in command mode:
if you press the key, which generates the ^[0A code, vi replaces this with
the k (one line up)
The next four lines (map!) work in insert/replace mode:
if you press the key, which generates the ^0A code, we leave insert mode
first, then do a k as above. Note, that insert mode is not enetered again
after this. You can do such, if you add an 'i' (for 'go into insert mode')
immediately after the end of each of these for lines. But this is confusing,
if you have been in replace mode before.
---original Question------
I am using Xterm, when I am in Insert mode and
use any of the up arrow, down arrow, left arrow
and right arrow keys I get these A, B, C , D letters
inserted in my file instead of scrollig the text.
------end----------