I'm VIM user for a few months now (life changing) but I have a small issue with the backspace key which is quite far from everything else (I already use CapsLock for the Esc key).

Which mapping is best appropriate for using vim and touch typing for the backspace key. Or is it my mistake for using backspace for deleting characters all together?

  • I have often heard people map jj to <esc>, since jj is rarely seen in actual typing. You could do something like that: inoremap jj <Backspace>. – muru Apr 6 '16 at 8:00
  • Muru's idea is not bad: I use jk because it feels easier than typing the same key twice, if you really want to remap backspace that cool be an option. – statox Apr 6 '16 at 9:24

I agree with statox's answer, and I want to point out that you have insert-mode ways of deleting more than 1 character at the time:

:h insert-index

|i_<BS>|    <BS>        delete character before the cursor
|i_CTRL-H|  CTRL-H      same as <BS>
|i_CTRL-U|  CTRL-U      delete all entered characters in the current line
|i_CTRL-W|  CTRL-W      delete word before the cursor

I found out that C-h was actually easier to type than the backspace key (little hands).

I don't think you need to remap backspace to anything for insert-mode deletion, there are already options for what you may want.

  • 1
    +1. All three of these combinations also work in just about any other terminal application or shell, so you gain transferable skills through these as well. (I'm so used to Ctrl-W that I sometimes accidentally close other applications trying to backspace a word!) – Soren Bjornstad Apr 9 '16 at 23:20
  • ctrl+h works even in Window's cmd and pwsh – Hope Mar 20 '19 at 10:04

Personally I don't have the backspace key remapped to another. Actually I think the important point about your question is how you use the different modes of Vim:

backspace erases characters only in insert mode which is only meant to insert text and do really minor changes to the text: This mean that you're supposed to use backspace only to erase 1 or 2 characters while you are inserting a new word.

If you need to erase more text, that means that you are supposed to switch to normal mode (or occasionally visual mode). The normal mode is meant to do bigger changes to your text:

  • If you need to erase a whole line you'll be able to use dd and if you need to erase the end of the line you'll be able to use D
  • If you need to erase the last 4 words you wrote you'll use d4b to say to Vim: "Use the deletion 4 words backward".
  • If you need to erase until a specific character (let's says a) you'll be able to use f, F, t or T in commands likes dFa to say "delete until the last a in the line"

So I think that you don't actually need to remap backspace because you're not meant to use it extensively.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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