11

I'm running a default cygwin install on Windows 8 and can not get the Backspace key to delete characters - I'm expecting the character to be overwritten with a blank when I backspace.

I've tried

set backspace=2 "
set backspace=indent,eol,start
:fixdel

nothing seems to work.

Both :verbose imap <BS> and :verbose imap ^H return No mapping found

7
  • Does Vim pick up the backspace at all? I use :echo getchar() as a sanity check for this sort of thing. Try running that command and pressing a key -- space or something -- on your keyboard. You should get a number (the key code) to appear. What happens if you do that and press backspace?
    – Pandu
    Oct 26, 2013 at 8:24
  • Yes, the cursor does move back. And when you exit insert mode, the characters are removed from view. When trying the :echo getchar() I get the following error "E319: Sorry, the command is not available in this version" Oct 26, 2013 at 11:24
  • so to be clear. I enter insert mode .. type 123456 ... hit backspace 3 times. This moves the cursor back 3 spaces. When I then his ESC to exit insert mode, characters 456 are removed .. I'd like them be remove while I'm in insert mode. Oct 26, 2013 at 11:27
  • What really is happening there is that the characters are getting removed, but your cygwin terminal isn't getting refreshed. Don't really know how to solve that. If you use gvim, though, you should be fine.
    – Pandu
    Oct 26, 2013 at 19:10
  • Thanks, but really looking for a solution that'll work in vim. Oct 27, 2013 at 14:47

6 Answers 6

21

Add these settings together:

:set nocompatible
:set backspace=2
0
2

Recently I’ve experienced a weird behavior in a Cygwin installation on Windows 7. When pressing the backspace key Cygwin, interprets it as a space.

Luckily, the problem is rather easy to fix. The easiest way (which did not work everytime while testing) is to simply reinstall terminfo and termcap via setup.exe, as mentioned here: Backspace does not work in Cygwin. If you don’t have termcap installed install it but make sure to reinstall terminfo properly too. At best this is all you need to do to get your backspace back again.

If not, you might need to remove .bashrc from your home folder, e.g. /cygwin/home/you/.bashrc. Then, just to make sure reinstall terminfo and termcap again. This always worked for me.

Enjoy your backspace :)

0

In command mode, have you considered just pressing an upper case 'X' in lieu of a backspace? This will remove one character to the left, very similar to the backspace behavior you are expecting.

0

I had the same problem and was unable to erase anything using backspace and when using the arrow button I got characters like ABCD.

I followed the below link and created ".virc" which fixed it and now I am able to use it. I deleted the ".vimrc" which was of no use.

https://www.quora.com/How-do-I-fix-the-annoying-arrow-key-and-backspace-problem-in-Cygwin

0

I just solved this for myself and thought I might have a correct answer for you:

type -a vim 

This revealed to me that vim was an alias to vi -N. If you see that then go to your setup-x86_64.exe (Cywgin setup, maybe different for example on 32 bit systems) and install the full Vim package.

Just a disclaimer: I get the impression that this is a symptom with more than a few root causes. Because this question has been open 5 years and still doesn't have an accepted answer I'm adding mine.

-1

I used this command :set nocp(and press enter) in the vi command line. But, you will need to do this every time you start vi.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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