LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Arch (https://www.linuxquestions.org/questions/arch-29/)
-   -   Key Bindings for "Home" and "End" (https://www.linuxquestions.org/questions/arch-29/key-bindings-for-home-and-end-858326/)

Mr. Alex 01-24-2011 07:00 AM

Key Bindings for "Home" and "End"
 
https://wiki.archlinux.org/index.php/Zsh#Key_Bindings

Quote:

File: ~/.zshrc

bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[4~" end-of-line # End
Added it to "~/.zshrc" as wiki says. But "Home" and "End" don't work in zsh, they do nothing. Why?

amani 01-24-2011 11:24 AM

how is zle running?

http://zsh.sourceforge.net/FAQ/zshfaq03.html#l27

Mr. Alex 01-25-2011 03:27 AM

I tried to put
Code:

[[ $EMACS = t ]] && unsetopt zle
to .zshrc but it doesn't fix the issue. And I don't quite understand you question.

Mr. Alex 01-25-2011 10:19 AM

Solved. The config for keys looks like this:

Code:

typeset -A key

key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}

[[ -n "${key[Home]}"    ]]  && bindkey  "${key[Home]}"    beginning-of-line
[[ -n "${key[End]}"    ]]  && bindkey  "${key[End]}"    end-of-line
[[ -n "${key[Insert]}"  ]]  && bindkey  "${key[Insert]}"  overwrite-mode
[[ -n "${key[Delete]}"  ]]  && bindkey  "${key[Delete]}"  delete-char
[[ -n "${key[Up]}"      ]]  && bindkey  "${key[Up]}"      up-line-or-history
[[ -n "${key[Down]}"    ]]  && bindkey  "${key[Down]}"    down-line-or-history
[[ -n "${key[Left]}"    ]]  && bindkey  "${key[Left]}"    backward-char
[[ -n "${key[Right]}"  ]]  && bindkey  "${key[Right]}"  forward-char



All times are GMT -5. The time now is 07:43 AM.