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 connect to my Debian Wheezy Beta 4 server with PuTTY 0.62 on Windows 7 I'm experiencing a problem. My login shell is Zsh and it is configured to handle ALT + DEL for the action delete-word (deletes one word to the right of the cursor). The line in configuration looks like this:

bindkey -e "\e[3;3~" kill-word

The binding works nicely when connected via the ssh command from a gnome-terminal. But when I connect via PuTTY this action is not executed. Instead a [3~ is put out to the console. As far as I see it this is the unescaped sequence for the DEL key in xterm. For a while I thought PuTTY would simply ignore the ALT modifier and send only DEL, but if that would be the case, the action bound to DEL would have been executed as if I pressed only that key.

So I guess PuTTY is using some sequence for the key combination which I do not know and which makes to output [3~ appear on screen. How can I find out which sequence PuTTY sends to configure Zsh to handle that correctly?

Update: It seems that PuTTY is supposed to ignore all ALT modifier keystrokes in its current implementation. Here is an excerpt from the source code file TERMINAL.C which deletes the ALT flag from the modifiers variable:

/*
 * Alt is only used for Alt+keypad, which isn't supported yet, so
 * ignore it.
 */
modifiers &= ~PKM_ALT;

That doesn't explain to me why pressing ALT + DEL doesn't have the same effect as pressing just DEL. Also it doesn't explain why the default key combination for the kill-word action in Zsh (ALT + D) works fine.

share|improve this question

1 Answer 1

A simple trick to get these sequences is to start cat on the remote host. That way I get ^[[3~ for DEL alone, but ^[^[[3~ with ALT+DEL. (PuTTY 0.62 on W7/64)

So, probably

bindkey -e "\e\e[3~" kill-word

will do what you want.

share|improve this answer

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.