Odd behavior of backspace in Vim (SSH to Linux from Mac)
Asked Answered
I

3

10

I didn't change any setting of my Vim, but today the Backspace gets some crazy behavior. Every time when I hit it, it does not delete a character, but prints ^?. Anyone knows what is going on?

Immixture answered 13/1, 2012 at 0:37 Comment(4)
What OS? Whst do you have in your .vimrc (can you put it down somewhere?)Thereon
Try to remove all the plugins and .vimrc and then look again to Backspace behavior. Is it changed? If yes, then you can at least find the reason by method of exclusion.Oto
@ldigas I login to Linux from a Mac via Terminal. .vimrc actually sources from a standard vimrc of my company. There is no recent change for this .vimrc source. @dimonomid Thank you! I just took it out. Still no luck. This may tell me that this problem may not come from the linux terminal.Immixture
Ok I logged to the Linux box directly and the vim worked just fine. That means the problem comes from the communication between the Mac and the Linux.Immixture
I
16

The problem comes from the communication between Mac Terminal the Linux Terminal.

Go to the Mac Terminal -> Preferences -> Advanced tab, check the option "Delete sends Ctrl-H". Then after I login to Linux, and Backspace works just fine in Vim.

Immixture answered 13/1, 2012 at 17:27 Comment(1)
Awesome. Though I wonder why it works sometimes even this setting.Protectionist
I
20

Not sure why it would randomly start doing this based on the information you gave, but trying adding this line to your .vimrc

set backspace=start,eol,indent
Incinerate answered 13/1, 2012 at 1:2 Comment(6)
I have tried this, and it does not work. :( Thank you though!Immixture
Are you using vim on a local machine or over a remote connection?Incinerate
over a remote connection. Does it matter?Immixture
Try the suggestions in the :fixdel section of the vim docs: vimdoc.sourceforge.net/htmldoc/options.html#:fixdelIncinerate
I also tried this. This makes Backspace work like Delete, which is not what I want.Immixture
This worked for me. I was having problems with backspace in vim when I was ssh'ing from mac to raspberry pi.Baird
I
16

The problem comes from the communication between Mac Terminal the Linux Terminal.

Go to the Mac Terminal -> Preferences -> Advanced tab, check the option "Delete sends Ctrl-H". Then after I login to Linux, and Backspace works just fine in Vim.

Immixture answered 13/1, 2012 at 17:27 Comment(1)
Awesome. Though I wonder why it works sometimes even this setting.Protectionist
T
0

In Mac Mavricks and Yosemite Open a terminal, then command+, for preferences, click on the profile tab, click on the -keyboard- menu, then add +

Key: very bottom, <= Delete
Modifier: ^ Control
Action: Send Text
Text: H

click Ok

Thermion answered 9/12, 2015 at 21:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.