You are not logged in.
I am using zsh with urxvt. I added the following to my .zshrc
```
key[Control-Left]="${terminfo[kLFT5]}"
key[Control-Right]="${terminfo[kRIT5]}"
[[ -n "${key[Control-Left]}" ]] && bindkey -- "${key[Control-Left]}" backward-word
[[ -n "${key[Control-Right]}" ]] && bindkey -- "${key[Control-Right]}" forward-word
```
as per the wiki https://wiki.archlinux.org/index.php/zsh#Key_bindings.
When I try to use Control-Arrow to move words, the words are duplicated and printed to the terminal.
Has anyone had success using Control-Arrow to jump words with zsh and urxvt?
Last edited by davidstein (2020-06-22 16:19:23)
Offline
Sounds like your prompt is broken. Paste your .zshrc and the output of "echo $TERM".
Offline
echo $TERM
rxvt-unicode-256colorcat .zshrc
# Lines configured by zsh-newuser-install
HISTFILE=~/.config/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt extendedglob
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/david/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
XDG_CONFIG_HOME=~/.config
# Autocomplete aliases
setopt COMPLETE_ALIASES
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
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]}"
key[Shift-Tab]="${terminfo[kcbt]}"
# Cursor movement
key[Control-Left]="${terminfo[kLFT5]}"
key[Control-Right]="${terminfo[kRIT5]}"
[[ -n "${key[Control-Left]}" ]] && bindkey -- "${key[Control-Left]}" backward-word
[[ -n "${key[Control-Right]}" ]] && bindkey -- "${key[Control-Right]}" forward-word
# Aliases
alias update="source ~/.config/.zshrc"
alias config="vim ~/.config/.zshrc"Thanks!
Last edited by davidstein (2020-06-22 01:28:11)
Offline
The prompt looks fine. Reading the wiki page, it looks like you are missing a block that is necessary for all those terminfo assignments:
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
Offline
Ahh I missed that. I added it in but still same issue. Its weird, the ${terminfo} variables seem to be empty when I echo them in the shell
Offline
I tend to just bind the escape codes…
bindkey "\e[1;5D" backward-word
bindkey "\e[1;5C" forward-wordOffline
I tried that but I still get the same issue
Offline
Output of "bindkey"?
Offline
No output when I run it
Offline
Something's off here - what if you run those command inside the shell?
Offline
Ahh sorry I messe up, this is the bindkey output
bindkey
"^A"-"^C" self-insert
"^D" list-choices
"^E"-"^F" self-insert
"^G" list-expand
"^H" vi-backward-delete-char
"^I" expand-or-complete
"^J" accept-line
"^K" self-insert
"^L" clear-screen
"^M" accept-line
"^N"-"^P" self-insert
"^Q" vi-quoted-insert
"^R" redisplay
"^S"-"^T" self-insert
"^U" vi-kill-line
"^V" vi-quoted-insert
"^W" vi-backward-kill-word
"^X^R" _read_comp
"^X?" _complete_debug
"^XC" _correct_filename
"^Xa" _expand_alias
"^Xc" _correct_word
"^Xd" _list_expansions
"^Xe" _expand_word
"^Xh" _complete_help
"^Xm" _most_recent_file
"^Xn" _next_tags
"^Xt" _complete_tag
"^X~" _bash_list-choices
"^Y"-"^Z" self-insert
"^[" vi-cmd-mode
"^[," _history-complete-newer
"^[/" _history-complete-older
"^[OA" up-line-or-history
"^[OB" down-line-or-history
"^[OC" vi-forward-char
"^[OD" vi-backward-char
"^[[1;5C" forward-word
"^[[1;5D" backward-word
"^[[200~" bracketed-paste
"^[[A" up-line-or-history
"^[[B" down-line-or-history
"^[[C" vi-forward-char
"^[[D" vi-backward-char
"^[~" _bash_complete-word
"^\\\\"-"~" self-insert
"^?" vi-backward-delete-char
"\M-^@"-"\M-^?" self-insertOffline
If you run "cat" and then enter ctrl+left and ctrl+right, what's the output?
Offline
ctrl+right = ^[Oc
ctrl+left = ^[Od
Same problem if I bind those
Offline
Try to run "zsh -f" (this will skip your zshrc) and try
% bindkey "\e[OD" backward-word
% bindkey "\e[OC" forward-word
# test here, if fails
% bindkey "\eOD" backward-word
% bindkey "\eOC" forward-word
# test hereand see whether one works there, then try to incoporate it in your zshrc
Offline
Well that at least stops the annoying word duplication, but now nothing happens when I control-Arrow. Maybe I'll keep trying things with zsh -f
Offline
Ok after zsh -f and opening a new shell,
bindkey "\e^[Od" backward-word
bindkey "\e^[Oc" forward-word
are working.
Thanks for the help
How do I mark as solved?
Last edited by davidstein (2020-06-22 16:03:54)
Offline
How do I mark as solved?
https://wiki.archlinux.org/index.php/Co … ow_to_post
Finally, when a solution is found, mark your thread as solved by editing the first post and prepending the tag [SOLVED] to the title in the "Subject" field.
Offline