Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fix my delete key in VIM over ssh? (Mac OS X)

Tags:

When I use VIM in the terminal on my local machine (Mac OS X Snow Leopard), the delete key is really backspace (i.e., destructive backspace).

When I SSH into a particular server, for some reason it's regular delete (i.e., delete the character under the cursor).

How can I change it to be consistent? I've tried a dozen solutions, but nothing seems to work.

Checking the "Delete sends Ctrl-H" box in Terminal Preferences->Advanced doesn't work -- this is non-destructive backspace.

I've tried about a hundred different key mappings in VIM, to no avail.

Interestingly, the key works as expected when I'm typing commands in VIM (e.g., : <something>) -- it's only screwed up when I'm editing the actual text. Any ideas?

like image 909
Aeonaut Avatar asked Nov 11 '10 19:11

Aeonaut


People also ask

How do you backspace on Mac terminal?

Control + H Essentially the same thing as backspace, but it is useful if you want to stay anchored on the home row keys.

How do I remove old SSH keys from MAC?

We pass the -R option to the ssh-keygen command to remove all keys belonging to the specified hostname (with optional port number) from a known_hosts file. This option is useful to delete hashed hosts.

How do I find vim on my Mac?

The path used by macOS's default vim install is /usr/share/vim/vimrc .


1 Answers

This worked for me:

:set backspace=indent,eol,start 

I'm not sure exactly what it does but it is listed as a possible solution here and here. I found this line in a vimrc file distributed with Ubuntu where the behavior of the mac "delete" key (otherwise known as the "backspace" key) works as expected without any other configuration.

The behavior I was experiencing was a bell sound (no characters deleted) when pressing the mac "delete" key (otherwise known as the "backspace" key) in insert mode. I am using a compiled version of vim 7.3 on "amazon linux" over ssh from a mac. Pressing <ctrl-v><delete> when in insert mode resulted in ^?.

like image 144
Nathan Buesgens Avatar answered Oct 06 '22 00:10

Nathan Buesgens