Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to configure following keys in vim?

  • Backspace key to delete a character backwards.
  • Delete key to delete a character forwards.

After reading some posts, I got to know that only one of those can be used to delete a character. But I guess the above behavior would be achievable.

Current scenario

  1. Backspace working as said above.
  2. Delete key is however acting weird. On pressing it, the character under the cursor get's replaced by ~, and later 5-6 keystrokes changes it to aplahabet and also change the case. Vim comes back to normal mode after that, leaving messed-up text.


$ bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
$ vim --version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Jun 12 2009 07:08:36)

If the above is not configurable, Please let me know, How I can at-least map Delete key to nothing, so that above weird behavior doesn't take place ?

share|improve this question
What terminal are you using? Is the TERM environment variable set correctly? – peterph Jan 8 '13 at 13:41
In a terminal, what do you see when you type Ctrl-V Del? Compare the output of :echo &term in Vim and echo $TERM in your shell - they should be the same. As mentioned above, make sure the $TERM value is correct, and then make sure the Vim term value matches. – jw013 Feb 7 '13 at 16:21

In the tcsh shell, add this line in your ~/.cshrc file:

stty erase '^?'
share|improve this answer

I do that with help of the stty command, just add this line to your .bashrc file:

stty erase ^?

you do that by typing stty erase and then Ctrl-V and finally press the Delete key.

Hope that fixes the problem.

share|improve this answer
The weird behavior is still present. – mtk Jan 8 '13 at 9:57

All the vim settings have to be done in a file called .vimrc located in $HOME. It is initially empty. I have vim 7.3 and both the keys are working fine. I suggest you to go through this link


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.