LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Backspace key mapping in vi (https://www.linuxquestions.org/questions/linux-general-1/backspace-key-mapping-in-vi-199544/)

arobic 06-30-2004 12:52 PM

Backspace key mapping in vi
 
Hi everyone!

This issue is driving me nuts since a while.

I am using a machine which has SuSE 7.2 installed and Vim 5.7.28 and the shell is zsh, for what it's worth. My problem is the following:

The backspace is working fine in the terminal (probably setup in the /etc startup file), but whenever I want to use it in vi, I obtain a big ^?. The delete key works, in deleting the following character, but not the previous one.

The thing is that I use another machine where this problem doesn't exist (different configuration). So I developped the habbit of using it and I keep using this freakin' backspace key (sorry for the abusive language ;) ) on the other machine even if I know it doesn't work and I can't get myself not to do it!! So, I would really like to make it work!

I've look for threads in other forum through google of people having the same problem and it seems that there is no official well-known wide-spread solution (at least not yet)! One of the option was to set stty erase ^? since the delete key and the backspace key can be interchanged, but I obtain the following error message:
>stty: invalid integer argument

So, there seem to be a problem in using this command. Can it be shell related? Cause in bash this command works fine.

So, is there anyone on this forum who ever encountered the same problem and solved it? Anyone else who would like to fix it? I would really appreciate your help, cause I am sick of always having to erase every ^? I make in my vi display!!

Thanks in advance guys!

darthtux 06-30-2004 01:16 PM

I have the following line in my ~/.vimrc
set backspace=indent,eol,start

If that doesn’t work, then hold down the Ctrl key and press backspace
at least as a temporary solution

arobic 06-30-2004 01:30 PM

Thx for your reply Darthtux!

As you guessed, the set backspace didn't work, but the control-backspace works! How come?

Also, the stty problem is in fact shell related. I discovered that I have to use bindkey in zsh to do the key mapping and again:
bindkey "^H" backward-delete-char
bindkey -v "^H" backward-delete-char
bindkey "^H" vi-backward-delete-char

all these don't work. Why??

Also, I still have to figure out why my backspace give me a ^? in vi instead of a ^H ? Is that normal? If I use bindkey with ^?, will it work or will it screw up my terminal settings?

Any input on that?

Does somebody know about zsh a bit to help me?


All times are GMT -5. The time now is 05:07 AM.