3

I am on a Unixware 7.1 box and can't seem to get VI to backspace properly. The current behavior is when you insert new characters and backspace over them, it will just shift the cursor to the left. However, if I open a fresh file and do not type any new characters, the behavior of backspace is to do nothing at all. The only time the cursor shifts is new files. Here is my .exrc:

set ts=4
#set nocompatible
#set backspace=2
set bs=indent,eol,start

I also tried set backspace= instead of bs=. As you can see I also tried the two commented out lines as well. Here is what my .profilelooks like:

stty intr "^c" erase "^?" swtch "^z" kill "^u"

The current behavior of backspace in a regular terminal session (in putty) with that .profile is to delete characters, so that aspect is working properly. Any would be appreciated!

6

I had to put the following in my .vimrc:

map! <C-h> <BS>

Note! Different systems handle backspace differently. To find out what your backspace is getting mapped to, start vi and go into insert mode. Press Ctrl+V and then Backspace. Most likely vim will output something like ^H. This means that Vi is not seeing backspace, but actually Ctrl+H.

Once you figure out what Vi is seeing you can simply remap that to backspace as I did.

  • 5
    You might find :help :fixdel interesting. – romainl Feb 25 '16 at 17:19
  • I went into insert mode and did a Control + V and all it inserted was ^ When I hit backspace it inserted a ? I then put map! <C-?> <BS> into my .exrc and it did not help. Have I put the correct thing in my .exrc? – user3080539 Feb 25 '16 at 17:30
  • 1
    The <C-h> mapping means Ctrl+h. By the same token <C-?> means Ctrl+?. This is not quite what you want since VI didn't output a "^?". Which ALSO means Ctrl+?. Confusing, I know. Based on the context the notation changes. Since it output only a ? I will direct you to the same place that @romainl directed me. In :help :fixdel it says: Note about Linux: By default the backspace key produces CTRL-?, which is wrong. You can fix is by putting this line in your rc.local: echo "keycode 14 = BackSpace" | loadkeys. Note, I haven't tried this as I'm not on a Linux machine ATM. – Tumbler41 Feb 25 '16 at 17:39
  • :help or :help :fixdel return "help: not an editor command". If I login and press bs in terminal it will output ^? in VI when I hit backspace. However even with it outpitting ^? in VI + the mapping, it still didn't delete. To get to the help you are merely typing :help after hitting escape? I think this machine is so old it may not have a help file. – user3080539 Feb 27 '16 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.