Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I use lynx via sshing to a Debian box from MacOS X (Leopard), it doesn't recognize my default backspace ('^?') as such. I would like to know how to map backspace to '^?' for that particular process. I haven't been satisfied with these solutions:

1) Setting Terminal to send ^H on Delete and then using 'stty erase ^H' in my bashrc. This makes things work for lynx but it breaks emacs; I'm used to hitting M-del to delete a whole word and using ^H breaks this behavior for me.

2) Recompile lynx to accept ^? as 'erase'. This isn't worth it to me.

3) Use a simpler term value like vt100. I use xterm-color because I like colors.

I've read this http://www.ibb.net/~anne/keyboard.html which was interesting, but configuring inputrc didn't help.

Thanks

share|improve this question
    
I'm surprised by the behavior you describe: backspace sending ^? is the default behavior on Debian (so it's supposed to work in all applications by default), and on my Debian (lenny) box, both ^? and ^h do backspace in lynx, with TERM=xterm-color and either stty erase '^?' or stty erase '^h'. –  Gilles Jul 19 '10 at 19:02
    
Here's a peek at my stty: intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = <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 -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe -echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke –  Avery Chan Jul 20 '10 at 7:02
add comment

2 Answers 2

Put it in your logon script on the debian box, or if you run emacs on that to, write a script called lynx that runs stty ... before running lynx.

share|improve this answer
    
This is sort of the solution that I'm looking for, but how do I call stty in the context of executing lynx without changing stty for the entire session? I tried putting the stty change in my login (.bash_profile) but it didn't do what I wanted it to do :( –  Avery Chan Jul 19 '10 at 13:41
    
Actually I tried this and it's not the solution I'm looking for. Terminal.app is set to send ^? and lynx doesn't recognize it. So I have to set both Terminal AND stty erase, but I don't want to do that. Theoretically, I'd like to map ^? to delete in lynx. So I need a way to do that just for lynx. –  Avery Chan Jul 21 '10 at 9:07
add comment
up vote 0 down vote accepted

Jacob's answer didn't work for me. lynx for my installation, treats ^? as \010 (backspace) instead of \177 (delete). With Jacob's suggested solution I would still have to change my usage of Terminal.app. Here's a solution that worked for me. Anne Baretta's page regarding backspace and delete was immensely helpful: Backspace/Delete Config.

一. Install expect if it's not installed already.

二. Create a script to replace lynx (or any other executable) like so:

    #!/usr/bin/expect

    eval spawn -noecho /usr/bin/lynx

    interact {
    \177        {send "\010"}
    "\033\[3~"  {send "\004"}
    }

三. Make the script executable and you're done!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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