Solved

backspace problem in cygwin

Posted on 2003-10-25
9
4,820 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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
 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Let’s list some of the technologies that enable smooth teleworking. 
This video shows how use content aware, what it’s used for, and when to use it over other tools.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.

828 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