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.

I cannot get Home and End keys to work for zsh under Cygwin. Various sources seem to suggest that

bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line

will fix the problem but this does not work for me. Strangely, after I enter

bindkey "\e[3~" delete-char

the Delete button starts working (before that it just outputs ~).

Does anyone has an idea what is going on?

I'm on Windows XP and I am using the latest versions of the available Cygwin packages.

UPDATE: This seems to be a problem with mintty, if I run cygwin.bat that launches the Windows command prompt, then everything works fine. Maybe it is related to this bug?

share|improve this question
    
If you call read, what does it output when you press Home and End respectively? –  slhck May 30 '12 at 12:18
    
If i run read from the terminal, and then press Home, the cursor jumps at the top of the screen. Is this what you meant? –  mavroprovato May 30 '12 at 12:52
    
Then you have to configure your terminal to actually pass these commands to the shell. No idea how this works in Windows though. –  slhck May 30 '12 at 12:57
add comment

2 Answers 2

up vote 4 down vote accepted

With the help of the mintty mailing list (https://groups.google.com/forum/?fromgroups#!topic/mintty-discuss/v4b86DBNI80) I found the answer. The lines that I need to add to .zshrc are

bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line 
share|improve this answer
    
Such an easy solution, thanks! –  b.long Aug 16 '12 at 14:29
add comment

Here my complete list of additional usefull bindings.

# ctrl-left/right
bindkey "\e[1;5C" forward-word
bindkey "\e[1;5D" backward-word

# ctrl-backspace/delete
bindkey "\C-_": backward-kill-word
bindkey "\e[3;5~": kill-word

# alt-backspace
bindkey "\e\d": undo

bindkey "\e[3~" delete-char
bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line
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.