You are not logged in.

#1 2019-01-03 23:24:22

krumelmonster
Member
Registered: 2015-04-27
Posts: 13

[SOLVED] urxvt with xterm keycodes

Hi,
I'm happily using urxvt(c) for my day-to-day terminal business. Because I don't want to install the urxvt terminfo in every machine I ssh to, I configured it to use xterm keycodes:

URxvt.termName: xterm-256color

URxvt.keysym.Control-Up:   \033[1;5A
URxvt.keysym.Control-Down:    \033[1;5B
URxvt.keysym.Control-Left:    \033[1;5D
URxvt.keysym.Control-Right:    \033[1;5C

URxvt.keysym.Home: \033[H
URxvt.keysym.End: \033[F

It works nice most of the time. The only issue I noticed is that Home and End don't behave correctly in vim, they do something that is not jumping to the start/end of the line. :set term=xterm won't help. cat -v gives the same codes in xterm and in rxvt, $TERM is set properly, the keys work correctly in zsh and bash; Just vim behaves odd.

Last edited by krumelmonster (2019-01-04 12:25:00)

Offline

#2 2019-01-04 08:13:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,796

Re: [SOLVED] urxvt with xterm keycodes

This is in my Xresources, please don't ask me where I stole that from ("I don't recall" ;-)

URxvt*keysym.Home:            \033OH
URxvt*keysym.End:             \033OF
URxvt*keysym.S-Home:          \033[1;2H
URxvt*keysym.S-End:           \033[1;2F
URxvt*keysym.M-Home:          \033[1;3H
URxvt*keysym.M-End:           \033[1;3F
URxvt*keysym.S-M-Home:        \033[1;4H
URxvt*keysym.S-M-End:         \033[1;4F
URxvt*keysym.C-Home:          \033[1;5H
URxvt*keysym.C-End:           \033[1;5F
URxvt*keysym.S-C-Home:        \033[1;6H
URxvt*keysym.S-C-End:         \033[1;6F
URxvt*keysym.M-C-Home:        \033[1;7H
URxvt*keysym.M-C-End:         \033[1;7F
URxvt*keysym.S-M-C-Home:      \033[1;8H
URxvt*keysym.S-M-C-End:       \033[1;8F

Offline

#3 2019-01-04 11:41:17

krumelmonster
Member
Registered: 2015-04-27
Posts: 13

Re: [SOLVED] urxvt with xterm keycodes

Thanks alot. These work in vim and bash, however, not in zsh. There it will print something like '\nH' (which will result in "H command not found").
Also, the cat -v output now differs between xterm and urxvt.

Edit: It really confuses me that with my above configuration, the output of cat -v is *identical* for urxvt and xterm. I assume that the keycodes are correct but somehow vim detects that this is a different terminal…

These codes worked, I only had to add

bindkey "${terminfo[khome]}" beginning-of-line
bindkey "${terminfo[kend]}" end-of-line

to my .zshrc

Last edited by krumelmonster (2019-01-04 12:26:05)

Offline

Board footer

Powered by FluxBB