numeric keys in vim are wrong in urxvt

26 views
Skip to first unread message

jo...@technoplaza.net

unread,
Sep 7, 2019, 5:52:32 PM9/7/19
to tmux-...@googlegroups.com

I’m having problems with certain keys on my numpad in vim when using tmux. They work outside of vim. It’s all the keys other than the numbers. The numbers work. (/ * - + . ENTER do not).

 

I am using rxvt-unicode-256color. When stating the terminal emulator, I have my TERM set to rxvt-unicode-256color. In tmux, the TERM is set to screen-256color.

 

The tmux version is 2.7 on the jump host I am using, but I installed a local copy of tmux 2.9a, and it made no difference.

 

If I set the TERM (in tmux) to rxvt-256color, the numpad keys work, but HOME and END stop working. I can fix that by setting the TERM to linux and then immediately back to rxvt-256color.

 

So the only way I have found to get all the keys working is to do this in my bashrc.

 

export TERM=linux

export TERM=rxvt-256color

 

Am I doing something wrong?

 

Thanks.

 

Nicholas Marriott

unread,
Sep 8, 2019, 4:46:13 PM9/8/19
to jo...@technoplaza.net, tmux-...@googlegroups.com
If you run "cat" inside tmux and press the problem keys, what do you see?

What if you do "tput smkx" then "cat"?
> --
> You received this message because you are subscribed to the Google Groups
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/tmux-users/002b01d565c6%248b73f4e0%24a25bdea0%24%40technoplaza.net.

jo...@technoplaza.net

unread,
Sep 9, 2019, 9:32:54 AM9/9/19
to Nicholas Marriott, tmux-...@googlegroups.com
This is pressing, on the numeric keypad, on an Apple keyboard, =, /, *, -, +, and ENTER.

$ cat
^K/*-+

/*-+
^C
$ tput smkx
$ cat
^K^[Oo^[Oj^[Om^[Ok^[OM

ojmkM

I get the same results inside vim before and after the tput command.

--John
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/20190908204627.ubfws6tkogndyu3e%40yelena.

Nicholas Marriott

unread,
Sep 9, 2019, 9:50:48 AM9/9/19
to jo...@technoplaza.net, tmux-...@googlegroups.com
This seems correct, this sounds like a problem with vim to me, the
numeric key escape sequences are not listed in terminfo so my guess
would be it is sending smkx and has hardcoded the escape sequences it
expects for TERM rxvt* but not for screen* and tmux*.

Don't you have a numlock? rxvt should send the symbols directly even
with smkx when it is on.

jo...@technoplaza.net

unread,
Sep 10, 2019, 10:16:12 AM9/10/19
to Nicholas Marriott, tmux-...@googlegroups.com
There is no key labeled "numlock" on my apple keyboard, the "clear" key in
the same place seems to function the same way.

I'm not really following about the escape sequences. Are you saying terminfo
with rxvt-256color, vim has a hardcoded understanding of the keys, but with
screen-256color, it does not? i.e. vim knows rxvt doesn't define these keys,
but someone patched vim to understand it rather than fixing the terminfo
file?

I was able to put this in vim to remap the keys, but it feels more like a
hack than a fix.

" fix keypad keys in tmux/urxvt
:inoremap <C-K> =

:inoremap <Esc>Oo /

:inoremap <Esc>Oj *

:inoremap <Esc>Om -

:inoremap <Esc>Ok +

:inoremap <Esc>OM <Enter>

:inoremap <Esc>On .

--John
https://groups.google.com/d/msgid/tmux-users/20190908204627.ubfws6tkogndyu3e
%40yelena.
>

Nicholas Marriott

unread,
Sep 10, 2019, 11:10:02 AM9/10/19
to jo...@technoplaza.net, tmux-...@googlegroups.com
Hi

I was wrong actually, rxvt-256color does list the keypad keys, but tmux
and screen do not so that's probably why it works and they don't. So
unless you want to build your own modified terminfo entry then mapping
them yourself in your vim config is the best solution.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/017e01d567e2%244b2eb640%24e18c22c0%24%40technoplaza.net.

jo...@technoplaza.net

unread,
Sep 10, 2019, 1:12:24 PM9/10/19
to Nicholas Marriott, tmux-...@googlegroups.com
Thanks. That's what I'll do for now then.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/20190910151017.cffvfhvgbe7uumme%40yelena.

Reply all
Reply to author
Forward
0 new messages