Make delete key in Vi and Vim in Mac OS X 10.5 send backwards delete (backspace) instead of forward delete

Alec Jacobson

September 07, 2009

weblog/

I recently upgraded to Mac OS X 10.5 and reinstalled vim (VIM - Vi IMproved 7.2). I noticed that the delete key on my keyboard was forward deleting (deleting the next character to the right of the cursor) rather than backward deleting (deleting the previous character to the right of the cursor). It felt like the backspace and delete (windows-style) keys had been switched or swapped.

Advanced settings in Terminal.app

I fixed the problem by changing my Terminal.app settings. Under Terminal > Preferences choose Advanced. Check "Delete sends Ctrl-H". Now, vi and vim should understand the delete key more intuitively. Note: Mapping the "delete" key in my vimrc file seemed like probably the correct way to do this, but that's a lot of trouble. Is there any reason not to do it this way?