Solved

backspace problem in cygwin

Posted on 2003-10-25
9
4,762 Views
Last Modified: 2013-11-15
I want to use cygwin in windows XP, but there is a problem with backspace key
it doesn't work like backspace in windows (backspace removes character before cursor position)

what should i do to make backspace key work like in windows?

thank
0
Comment
Question by:nk2003
  • 5
  • 3
9 Comments
 
LVL 6

Expert Comment

by:durindil
ID: 9623045
stty erase (type backspace key)

If should look like this:

# stty erase ^h
0
 

Author Comment

by:nk2003
ID: 9624689
where should i type that command?
when i tried to type in cygwin prompt,  i tried "stty erase <press backspace key>" but i didn't show ^h, it just moved the curcor, 1 step to the left

0
 

Author Comment

by:nk2003
ID: 9624710
sorry I forgot something, the problem is not in cygwin prompt, but when I use VIM
0
 
LVL 20

Expert Comment

by:Gns
ID: 9626651
Vim will use your terminals (cygwin in this case) defenition of erase, so the advice above is valid.
What value has erase? View it with
stty -a
at the bash prompt.
If you are unsure of what the backspace key generates, type
<ctrl>-<v><Backspace>
at the bash prompt.

You might also want to look at ":map"/":map!" .... ":help map" might be a start.

-- Glenn
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:nk2003
ID: 9627058
I had tried <ctrl>-<v><Backspace>, but it result is ^? (not ^h)
is it correct?
but it didn't solve the problem...


here is result from "stty -a": (maybe usefull)

$ stty -a
speed 38400 baud; rows 43; columns 125; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo -echoe -echok -echonl -noflsh -tostop -echoctl -echoke
0
 
LVL 20

Expert Comment

by:Gns
ID: 9627296
>I had tried <ctrl>-<v><Backspace>, but it result is ^? (not ^h)
Shows that your backspace key generates DEL (delete) instead of backspace (^h)
But since stty -a show that you have
> erase = ^?;
you _should_ be fine with this. In vim, the :map command could show what mappings are in effect. If ^? is interpreted as del, and not as backspace, this might explain your problems.
Do you have an .exrc or .vimrc file? Content? I'd suspect not, but there ($HOME/.vimrc) is perhaps where you should put the following
:set t_le=^?
(note that you need generate the DEL character with <Ctrl>-<v><your DEL/backspace key>, so that it is one character and not two as in <^><?>)

You can check the value of t_le in vim by the
:set termcap
command, and you can test that the line above works there too, before putting it in a .vimrc file.

-- Glenn
0
 

Author Comment

by:nk2003
ID: 9627468
great, It solved the probem, but it cannot remove the end of line

for example:
abcdefghij
klmnopq_  

(_ : cursor)
when I use backspace (at that cursor position), it removed klmnopq
but when i press backspace again, the cursor didn't move to upper line (after j character)

what should i do?
0
 
LVL 20

Accepted Solution

by:
Gns earned 125 total points
ID: 9627636
Read the docs:-) :help is there for you:-):-). ":help set" will show some, and also look at examples in /usr/share/vim/vim61/vimrc_example.vim (or similar).

Actually, to allow "backspacing" to delete lines you might add
set backspace=indent,eol,start
to your .vimrc file.

-- Glenn
0
 

Author Comment

by:nk2003
ID: 9627684
thank you....
very good explaination...
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now