Why does the behavior of Backspace change in vim with SSH?

7

When I'm accessing one particular machine through ssh, the behavior of Backspace in vim changes. Instead of deleting chars, i have a ^? .

The problem is this machine acts as gateway and this problem is propagated when i'm accessing any machine behind this gateway (when I'm ssh-ing any of these machines inside the domain -without going through the domain-, i don't have this problem)...

This is not a big deal but it's really annoying.

Any idea ?

LB40

Posted 2009-08-28T15:00:18.473

Reputation: 4 729

Answers

9

It's usually a mismatch between what's configured in you shell and what's configured in your terminal emulator.

Some use backspace (0x08), some use DEL (0x7f). If, from within your terminal session, you run

stty -a

you'll see a line like:

intr = ^C; quit = ^\; erase = ^?; kill = ^U; ...

That erase is the DEL character. You need to either configure your SSH to transmit that character or do a:

stty erase '^H'

to change the shell.

I know that Putty, for one, can change the character transmitted when you hit the backspace key. I think it's buried in the terminal section somewhere (at least in v 0.58) but I don't have Windows handy to check it.

However, it's not really programming-related so you may find this gets shifted over to superuser.com.

user53528

Posted 2009-08-28T15:00:18.473

Reputation:

1It's under Terminal->Keyboard->"The BackSpace Key" in case anyone is having trouble finding it – Katerberg – 2011-01-11T15:04:00.133

thanks... i knew it was not "really" programming-related but I didn't know from where the error stems. – None – 2009-08-28T15:31:01.833