I just installed Cygwin and the BACKSPACE functionality is not there, i.e. when I hit the Backspace key, I get a space.
I've been trying to research this issue on Google, but did not find anything conclusive.
In my case backspace was not at all working after creating blank ~/.vimrc. Following change made it work
Put:
set bs=2
in .vimrc
Found this at http://linux-journal.blogspot.com/2005/04/fix-vim-backspace-doesnt-work.html
Worked for me: In the Windows command prompt, type
echo export TERM=cygwin >> C:/cygwin/home/YourUser/.bashrc
This will add it to the .bashrc
and everything may work nicely!
TERM
environment variable set to msys
via the Windows environment variable settings as suggested on StackOverflow to help with git
problems on Windows. Simply resetting it to cygwin
in .bashrc
didn't help, but removing the TERM
entry from the Windows settings did. Thanks for pointing me into the right direction!
Commented
Jul 26, 2013 at 9:01
I found a solution to a problem that presented like the one above.
Simply run Cygwin setup again and reinstall termcap
and terminfo
. If you use the search box you can find them quickly. Instead of saying "Keep" for each, click it to make it say "Reinstall". You may have to check the "Hide Obsolete" checkbox for term
to appear in the search.
My terminfo folder was entirely missing. No idea why. Hope this helps someone.
Edit your c:\cygwin\cygwin.bat
Place this: SET TERM=cygwin
before: bash --login -i
When you set the TERM type you are telling the host which TERMCAP to use to draw within the terminal window. Most *NIX hosts don't know what a 'cygwin' termtype is so they don't know how to do onscreen character manipulation such as inserts, deletes, scrolls, font changes, etc.
If you change the TERM variable in CYGWIN before telnet or SSH to a host you will get much better results:
In CYGWIN:
d@test01 ~
$ TERM=ansi;export TERM
$ ssh suntest1
d@suntest1's password:
Sun Microsystems Inc. SunOS 5.8 Generic patch October 2001
d pts/1 test01 Fri Oct 12 00:15 still logged in
$ echo $TERM
ansi
$_
The host now knows you have an ANSI terminal type and it can use it's ANSI TERMCAP file to tell it how to communicate.
If you can't get that to work and most everything works properly except the backspace, you can reprogram "getty" on the host you connect to to recognize what you want, and here's how (this is the oldest, most common and most universal way of solving backspace/delete issues):
You ssh or telnet to your host and in the host you run the stty command. If you hit the "BACKSPACE" key and it does not go backward it's because the terminal is probably looking for a different character based on the TERM type. Rather than dig through all of that you can manually set the backspace definition at the CLI or in your .profile, .bashrc, or .bash-profile file in your $HOME directory as you desire or based on the flavor of *NIX you are using.
So if you press ^H (that's CONTROL-H) and your key backs up but you hit the BACKSPACE key and it does not try using stty as follows:
stty erase \*<HIT YOUR BACKSPACE KEY HERE>*[ENTER]
Most of the time it will look like this:
stty erase \^?[ENTER]
The '\' tells it that the next character is going to be a non-printable control-character and to accept it, not "interpret" it.
Once you press [ENTER] you should be able to press your [BACKSPACE] key and have it backspace/delete whatever you typed.
You can set this in your shell.
Now, if you still use VI, sometimes the translation doesn't work and you have to actually type ^H in vi, but that's OK.
You could have said:
stty erase k[ENTER]
and it literally would have translated 'k' into the erase/delete character..
-D
options
Keys
tabBackarrow sends ^H
This is the only thing that worked for me, especially since if you have to SSH to a server (not all fixes will work) I used to add stty erase ^?
to my .bashrc but this only fixed the issue 80% of the time.
Ok, I had this issue with manually updating a Cygwin install. Anyway I found this post, which lead me to the solution for my install.
The older cygwin had a file /etc/terminfo/c/cygwin
, but in the newer cygwin it expected the file to be /etc/terminfo/63/cygwin
.
Once I copied the "cygwin" file to this location, the bash shell backspace key worked fine, as did tab and others.
Changing the TERM
variable to cygwin
and adding SET TERM=cygwin
to the .bat
file didn't work for me, but I fixed it. Here what I did: In package manager due installation I selected to install xterm: X11 terminal emulator
, after installation I added SET TERM=xterm
to the .bat
file (like proposed above), launched terminal and in Options -> Terminal menu selected Type=xterm
, then restarted terminal. Backspace started to work correctly!
Note: if you already installed cygwin – just run installer again and add xterm package.
I'm running:
I agree with all the answers here. But there is a far simpler way found here: http://lifepluslinux.blogspot.in/2014/08/backspace-doesnt-work-in-vim-on-cygwin.html
Worked for me: In the Windows command prompt, type
(echo; echo "export TERM=cygwin") >> ~/.bash_profile
This will add it to the .bash_profile (not .bashrc, which didn't work for me, and with a leading line break)
After spending 2 days of time reading stuff online. I found this one that worked for me. I do not know if this case matches every one. But it worked like a charm to me thanks to Yuksel
The problem was with 'termInfo' files, Steps he have suggested
confirm if the problem is terminal related by typing in CygWin Terminal, this should give (ignore the warning)
less my_session.log
WARNING: terminal is not fully functional
Get the information of 'TermCap' to which path or directory it is related to by typing below code in CygWin Terminal
infocmp -C
you should either get
infocmp: couldn't open terminfo file /usr/share/terminfo/63/cygwin
Or you might also get something starting with text like 'Reconstructed via infocmp...'
Run the below code in CygWin Terminal to run the diagnostics to get extra details about the path where the files are saved
cygcheck -s
that should respond you similar to below text
Cygwin Configuration Diagnostics
...
C:/cygwin / system binary,noacl
C:/cygwin/bin /usr/bin system binary,noacl
C:/cygwin/lib /usr/lib system binary,noacl
C:\cygwin\etc\terminfo /usr/share/terminfo system binary,noacl
cygdrive prefix /cygdrive user binary, noacl, posix=0, auto
...
C:\cygwin\etc\terminfo /usr/share/terminfo system binary,noacl
from the output, you got from the 3rd step. now copy all the files and folders that exist inside /usr/share/terminfo to the folder C:\cygwin\etc\terminfo - NOTE: this folder might be different from yours depending on the installation
Never experienced your problem. Try to install the Terminal Emulator Mintty (http://code.google.com/p/mintty/).
It's available through the Cygwin installer. Best Terminal for cygwin.
stty
command?