Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

When i hit backspace in insert mode in vim it forward-deletes, how can i make it backward-delete?


I get (| is the cursor position):

aaa|bbb --3-backspace-hits--> aaa

I want:

aaa|bbb --3-backspace-hits--> bbb

Any suggestions would be helpful. Thanks!

share|improve this question
Looks like a terminal problem more than a vim problem. Care to detail how you're using vim ? is it gvim, vim under a TERM=vt100 terminal, vim under a TERM=xterm terminal, etc ? – Baramin Nov 28 '10 at 14:19
That's it. I am using xterm and now that I've tried it with konsole it is working fine. Do you have an idea what the problem might be? – stnr Nov 28 '10 at 14:32
Try to type this in the xterm before running vim: stty erase ^H (and to do the ^H, you type Ctrl-V then the backspace key) and tell us how it went – Baramin Nov 28 '10 at 17:05
It's worth trying Ctrl-Backspace in vim too, too see if they're not inverted. – Baramin Nov 28 '10 at 17:06
up vote 1 down vote accepted

I can't verify this with my setup (I can't get my backspace key to misbehave in an xterm), but I think this behavior is controlled by the xterm controls backarrowKeyIsErase and/or backarrowKey. You can read about these in the xterm man page. You might try holding the Ctrl key while you press the left mouse button in your xterm window and checking or unchecking Backarrow Key (BS/DEL).

On a different system that the one I'm using now, I had this in my ~/.Xdefaults file:

xterm*backarrowKey: TRUE

so you might also try that. For new settings in a ~/.Xdefaults file to take effect, you'll have to either log out and back in, or execute this command at a shell prompt:

xrdb -override ~/.Xdefaults
share|improve this answer

I believe you are looking for Control + W to delete the word before the cursor.

For character level control, you use the "delete text of movement command": dh will (d)elete one character to the left. d2h will delete 2 characters to the left, etc...

share|improve this answer
I want the backspace button to do on insert mode what dh does on edit mode. Currently the backspace button delete forward not backwards as "dh". Do you see what i mean? – stnr Nov 28 '10 at 13:34

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.