OK. So you think it is the problem with your key code. Right?
we will test it from vi.
type ":map ^[OA k" then ENTER.
How u will enter '^['. by pressing '^' then '[' NO
first press <Ctrl>-v then <Esc>. this will generate '^['. Now try to use your UP arrow. it should work as if you were using k.
the above UP arrow mapping only works if you are in Command mode. What if we are in insert mode. we need specail mapping with map!.
type ":map! ^[OA ^[ka".
now if we are in insert mode we should able to use UP arrow for moving cursor one line up. what it really does? when we press UP arrow it will first generate <Esc> (so now we are in command mode) then k (cursor one line up) then a (return to insert mode).
below is the complete arrow key mapping. First try it from vi then add it to your .exrc (make backup). do not use ':' when adding to ".exrc".
:map ^[OA k #up
:map ^[OB j #down
:map ^[OD h #left
:map ^[OC l #right
:map! ^[OA ^[ka #up
:map! ^[OB ^[ja #down
:map! ^[OD ^[hi #left
:map! ^[OC ^[la #right
if you want to add mapping to function keys:
map #2 :set number #set line number F2
map #3 :set nonumber #unset line number F3
note: in my system UP arrow key sends ^[OA. it may be ^[[A in your system. if so replace all 'O' with '['
hope this will help you.
[Edited by mib on 02-27-2001 at 04:46 AM]