Full credit to Michael S. Kirkpatrick
The following fix saved my sanity
I prefer using vi as my text editor, because it is clean and simple. I don’t have to go searching for commands from drop-down boxes and other GUI crap. But arrow keys and backspace are sometimes problematic, depending on the OS you’re using. In my case, I frequently ssh from Linux to SunOS, and the SunOS vi doesn’t like my keyboard mappings.
Here is my (partial) solution. Open ~/.exrc and add the following lines. In case it is not obvious, do not type the letters inside brackets, but press those keys instead (i.e., [ctrl-v] means you hold the Ctrl key while pressing v).
— Michael S. Kirkpatrick
:map! [ctrl-v][backspace] [ctrl-v][esc]xa :map! [ctrl-v][up-arrow] [ctrl-v][esc]ka :map! [ctrl-v][down-arrow] [ctrl-v][esc]ja :map! [ctrl-v][right-arrow] [ctrl-v][esc]la :map! [ctrl-v][left-arrow] [ctrl-v][esc]ha
When you type these in (assuming you’re using vi or vim, these lines will look like this.
:map! ^? ^[xa :map! ^[OA ^[ka :map! ^[OB ^[ja :map! ^[OC ^[ha :map! ^[OD ^[la