Fix Arrow Keys in VI on Solaris

This was taken from http://www.unix.com/unix-dummies-questions-answers/59467-sunos-5-10-vi-arrow-keys-not-working-post302181425.html and I didn’t want to lose it.

Enter the following into $HOME/.exrc file. First entry is to make DELETE work as Backspace and Remaining/Subsequent 4 entries are traversal into file using Arrow-Key. All 5 entries are applicable for “Editing” mode of vi editor.

DO NOT COPY/PASTE THIS:
:map! ^? ^H
:map! ^[OA ^[ka
:map! ^[OB ^[ja
:map! ^[OC ^[la
:map! ^[OD ^[ha

To type all CONTROL (the ^ and ^[ characters) characters:
^? = CTRL-V + DELETE
^H = CTRL-V + BACKSPACE
^[OA = CTRL-V + UP-Arrow
^[ka = CTRL-V + ESCAPE + k + a
^[OB = CTRL-V + Down-Arrow
^[ja = CTRL-V + ESCAPE + j + a
^[OC = CTRL-V + Right-Arrow
^[la = CTRL-V + ESCAPE + l + a
^[OD = CTRL-V + Left-Arrow
^[ha = CTRL-V + ESCAPE + h + a

Leave a Reply

Your email address will not be published.