Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
Delete Key Doesn't Work in xterm - How to Fix It?
I am running Apple's X11. From within an xterm, when I press the Delete key, I get a nasty key code that xterm doesn't recognize as delete. I would like to remap that so that it works as intended. As an example, this would remap the Backspace key:
xmodmap -e "keycode 59 = BackSpace"
What is the magic keycode and word for Delete? Something along the lines of:
xmodmap -e "keycode xy = Delete" ?
In this case, what is the value of "xy", and is "Delete" the correct keyword?
Thanks!
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007
Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
Nope, that didn't do it! I opened an xterm and tried this, but I still get junk when I press the delete key.
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007
Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
Well not exactly rman. In the "right out of the box" configuration (Apple's X11 as it came, I haven't mod'd Xresources, Xmodmap, etc.), when I press the Delete key I get some form of escape sequence that puts a few characters of jibberish in the screen. Starting from there, if I type "stty erase <press Delete key>" and try using the Delete key (desired behaviour is that it deletes the key under the cursor, not the one to the left of the cursor, like Backspace does) I still get jibberish.
I did eventually modify this such that the Delete key at least behaved like Backspace (trying out a suggestion I found on Google) by adding
xterm*.deleteIsDEL: true
to a .Xresources file. If I now restart Apple X11, the Delete key works like the Backspace key.
If I now follow your prescription above, pressing the Delete key where you say "deletekey" simply backspaces! I tried doing it "literally" (ctl-v, then Delete), the Delete kill still behaves like Backspace.
I have also tried "stty kill <press Delete key>" to no good end.
This is pretty frustrating. I have a perfectly good Delete key that will only Backspace. I am sure that some magic combination of Xresources, xmodmaps and sttys will do the job, but I am stuck for the prescription!
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007
Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
Solved it! Finally, here is how to make your Delete key act like a real Delete key, which is to say that it deletes the character currently under the cursor rather than doing a Rubout (delete the character to the left of the cursor) or worse still, insert a "~" into the line.
This solution is specific to the bash shell, and works for bash under both Apple's X11 xterm and Terminal.app (bash is the default shell in both cases).
Create a file in your home directory called .inputrc - Put the following single line into that file:
"\e[3~": delete-char
Restart Terminal.app or create a new xterm if using X11. Thats it! I have tested it and it works like champ. bash apparently reads this file every time it starts.
You can read LOTS more about this problem and related problems by Googling the phrase "bash delete key". Apparently this is a VERY common issue.
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007