stty erase?

Dan Coutu coutu at snowy-owl.com
Wed Dec 17 15:38:06 EST 2003


Charlie Farinella wrote:

>Hi,
>
>Probably a rudimentary question and maybe off topic, but it's making me
>nutty.
>
>This relates to the backspace key using vim in a terminal.  I find no
>consistency from installation to installation.  Some of these machines
>work as expected, others print ^? when I strike the backspace key, but
>work if I hold down the shift key.  One machine (Slackware) works ok
>when I login as a user using xterm or rxvt, but not if I su to root.  If
>I use aterm then it doesn't work no matter who I am.  Most of these are
>RedHat installations various versions, two Slackware, one OpenBSD.  
>
>How is this controlled, and what do I need to set it to?
>
>--charlie
>  
>
The mapping of your keyboard keys to characters is done using different 
rules. That's the source of
all the variation you're seeing.

You can use stty to change the character to use for different 
operations. For example to setup the
traditional backspace as the character that erases the character to the 
left of the cursor do this:

stty erase ^h

On the other hand if your backspace key mapped to send an ASCII DEL 
character (delete) then
do this:

stty erase ^?

Now you see what that ^? means. It represents the DEL character (ASCII 127).

You can use stty to set things up as you choose. I'm betting though that 
there are even more
elegant ways to do keyboard mapping and undoubtedly someone will explain 
how just
as soon as I post this... (It always seems to work that way!)

Hope this helps,

Dan




More information about the gnhlug-discuss mailing list