I know that in vim I can add
.vimrc to avoid that arrow keys display A, B, C, D in insert mode.
But I'm using vi Version 4.0 (gritter) 12/25/06.
How can I obtain the same behavior?
== EDIT == (1)
I'm using the vi version from Arch Linux which is built from this CVS repository (last commit 24 February 2007) with the following command:
make PREFIX=/usr LIBEXECDIR=/usr/lib/ex PRESERVEDIR=/var/lib/ex \ TERMLIB=ncurses FEATURES="-DCHDIR -DFASTTAG -DUCVISUAL -DMB -DBIT8"
and with theses three patches: fix-tubesize-short-overflow.patch, navkeys.patch and preserve-dir.patch.
== EDIT (2)==
The problems happens in LXTerminal 0.2.0, Termite 10-1, Tilda 1.2.4-1, Terminator 0.98-1 and xterm 320-2 but not in urxvt v9.21 nor in the Linux virtual consoles.
== EDIT (3)==
According to the Single Unix Specification left-arrow, down-arrow, right-arrow, up-arrow correspond to respectively the following capname :
kcuu1. Comparing terminfo entries from
rxvt-unicode-256color for these capterms gives:
$ infocmp xterm rxvt-unicode-256color | grep -E 'kcuf1|kcub1|kcud1|kcuu1' kcub1: '\EOD', '\E[D'. kcud1: '\EOB', '\E[B'. kcuf1: '\EOC', '\E[C'. kcuu1: '\EOA', '\E[A'.
Modifying the xterm terminfo entry by substituing
'\E[A' should solve the problem but is it a good idea? Maybe it will break other programs arrow keys usage?
terminfodatabases is out of synch with the codes produced by the keyboard. The solution is not to change the
TERM, but to find out if your
viis linked against
terminfo, find the keycodes emitted by the keyboard, and fix the corresponding database accordingly. Complaining to the sysadmin might work, too.