You are not logged in.
Pages: 1
Topic closed
Since i installed zsh i cannot use home, end and del keys anymore. They do strange things. Home/End:
martin@myhost> H
vim
I guess this is useful to execute lots of commands, but i don't want those keys to make that.
Del:
martin@myhost> PACman
It turns 3 letters into uppercase and then i cannot do anything but presing enter to return functionality in writing.
This hapens only under zsh, in consoles and terminal emulators, for both root and user. This Why don't my Home and End keys work in terminals? doesn't seem to be my problem.
Thanks in advance.[/code]
All your base are belong to us
Offline
zsh unfortunately doesn't read /etc/inputrc, which tells the shell what commands sent by the terminal emulator mean.
add the following to your .zshrc, and you should be fine.
# key bindings
bindkey "e[1~" beginning-of-line
bindkey "e[4~" end-of-line
bindkey "e[5~" beginning-of-history
bindkey "e[6~" end-of-history
bindkey "e[3~" delete-char
bindkey "e[2~" quoted-insert
bindkey "e[5C" forward-word
bindkey "eOc" emacs-forward-word
bindkey "e[5D" backward-word
bindkey "eOd" emacs-backward-word
bindkey "ee[C" forward-word
bindkey "ee[D" backward-word
bindkey "^H" backward-delete-word
# for rxvt
bindkey "e[8~" end-of-line
bindkey "e[7~" beginning-of-line
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
bindkey "eOH" beginning-of-line
bindkey "eOF" end-of-line
# for freebsd console
bindkey "e[H" beginning-of-line
bindkey "e[F" end-of-line
# completion in the middle of a line
bindkey '^i' expand-or-complete-prefix
by the way, i've changed some of the keys. for instance, ctrl-left and ctrl-right move back and forward by whole words. default is alt i believe.
Offline
Does inputrc not work for zsh?
Offline
Does inputrc not work for zsh?
riiight, it's inputrc that doesn't work with zsh, not termcap. i got confused. corrected my post. thanks phrakture
Offline
Thanks a lot!!!
I guess this should be on the zsh-wiki, I'll add it.
All your base are belong to us
Offline
I prefer this solution, as it will adapt to whatever setup you are currently using:
autoload zkbd
[[ ! -f ${ZDOTDIR:-$HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE ]] && zkbd
source ${ZDOTDIR:-$HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE
[[ -n ${key[Backspace]} ]] && bindkey "${key[Backspace]}" backward-delete-char
[[ -n ${key[Insert]} ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n ${key[Home]} ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n ${key[PageUp]} ]] && bindkey "${key[PageUp]}" up-line-or-history
[[ -n ${key[Delete]} ]] && bindkey "${key[Delete]}" delete-char
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
[[ -n ${key[PageDown]} ]] && bindkey "${key[PageDown]}" down-line-or-history
[[ -n ${key[Up]} ]] && bindkey "${key[Up]}" up-line-or-search
[[ -n ${key[Left]} ]] && bindkey "${key[Left]}" backward-char
[[ -n ${key[Down]} ]] && bindkey "${key[Down]}" down-line-or-search
[[ -n ${key[Right]} ]] && bindkey "${key[Right]}" forward-char
Offline
Well I now have a problem with this. The keys worked a few hours ago. Now they don't. I commented everything in my .zshrc but the keybindings but they still didn't work. I haven't really done anything other than creating ~/.zprofile with this content (or at least I can't remember):
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/vc/1 ]]; then
startx
logout
fi
The stuff under "reading $terminfo[]" from http://zshwiki.org/home/zle/bindkeys works, but it's extremly slow. It takes about a second for the cursor to move to the front when pressing home.
This is my .zshrc so far http://pastebin.com/m66ede710
Offline
The code of key bindings in the 2nd post may have missed "\" before the letter "e", or it won't function on my roxterm. For example:
bindkey "\e[3~" delete-char
Last edited by cwjiof (2009-03-31 10:38:50)
Offline
The code of key bindings in the 2nd post may have missed "\" before the letter "e", or it won't function on my roxterm. For example:
bindkey "\e[3~" delete-char
I had the same problem (years ago, it seems). That solution perfectly solve it.
bop
Offline
Hi bop, welcome to the forums. However, the thread you posted in is far more than two years old so not many will appreciate your experience any more.
Please read our forum etiquette esp. the section about necro bumping.
Closing.
To know or not to know ...
... the questions remain forever.
Offline
Pages: 1
Topic closed