0

enter image description here

I want pressing backspace to result in:

enter image description here

For references

doing just x or just dl produces

enter image description here

and dh gives

enter image description here

Joshua
  • 19
  • 3

2 Answers2

0

Add the following to your .vimrc:

nnoremap <BS> x

This adds a non-recursive mapping to normal mode, where <BS> now performs x.

If you just want to test this mapping without adding it to your .vimrc, enter command mode with : , type in the line above, then hit enter.

OSH
  • 741
  • 4
  • 11
0

you can map <BS> to do x and then h:

nnoremap <BS> xh

This should be what you are looking for.

update, handle the EOL case:

nnoremap <expr> <BS> col('.')==(col('$')-1)?'x':'xh'
Kent
  • 189,393
  • 32
  • 233
  • 301
  • I wonder if what I want is truly possible, so this works with one exception. If the character deleted is the last character of a line then it moves to the left twice. This is because first it does x which deletes the character but now there is no character so it moves left, then it does the h which moves it left again but in this case we do not want that. – Joshua Apr 08 '20 at 16:24