Discussion:
tmux xterm-keys, emacs, shift-arrow keys, and ... a custom TERMINFO?
Michael Sheldon
2011-11-18 17:58:36 UTC
Permalink
Hello tmux-users,

I'm trying to figure out how to get emacs to see the shift-arrow keys when
run under tmux. I think I have a good solution for this, but I don't see it
documented in any of the FAQs, so I wanted to run it by this list to see if
there are any gotchas.

Problem: emacs doesn't understand shift-arrow keys even though I enabled
xterm-keys under tmux.

I think the root cause is that the standard screen- based TERM definitions
do not document these escape codes.

I've built a custom .terminfo file containing:

# A screen- based TERMINFO that declares the escape sequences
# enabled by the tmux config "set-window-option -g xterm-keys".
#
# We prefix the name with xterm- since some applications inspect
# the TERM *name* in addition to the terminal capabilities advertised.
xterm-screen-256color|GNU Screen with 256 colors bce and tmux xterm-keys,

# As of Nov'11, the below keys are picked up by
# .../tmux/blob/master/trunk/xterm-keys.c:
kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H,
kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~,
kRIT=\E[1;2C,

# We run tmux under xterm, which supports bce.
# So use screen-256color-bce as our base.
use=screen-256color-bce,


and build this with tic. I can now use this in my .tmux.conf:

set -g default-terminal "xterm-screen-256color"


And now emacs behaves basically the same when run within tmux as it does
when run in my xterm terminals.

I'm curious why this isn't documented in the FAQ? Is there some down-side
to using this technique to make emacs happy?

Thanks for your thoughts,

--Michael Sheldon
Nicholas Marriott
2011-11-21 22:50:39 UTC
Permalink
No this is a fine way to do it.
Post by Michael Sheldon
Hello tmux-users,
I'm trying to figure out how to get emacs to see the shift-arrow keys when
run under tmux. I think I have a good solution for this, but I don't see
it documented in any of the FAQs, so I wanted to run it by this list to
see if there are any gotchas.
Problem: emacs doesn't understand shift-arrow keys even though I enabled
xterm-keys under tmux.
I think the root cause is that the standard screen- based TERM definitions
do not document these escape codes.
# A screen- based TERMINFO that declares the escape sequences
# enabled by the tmux config "set-window-option -g xterm-keys".
#
# We prefix the name with xterm- since some applications inspect
# the TERM *name* in addition to the terminal capabilities advertised.
xterm-screen-256color|GNU Screen with 256 colors bce and tmux xterm-keys,
# As of Nov'11, the below keys are picked up by
kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H,
kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~,
kRIT=\E[1;2C,
# We run tmux under xterm, which supports bce.
# So use screen-256color-bce as our base.
use=screen-256color-bce,
set -g default-terminal "xterm-screen-256color"
And now emacs behaves basically the same when run within tmux as it does
when run in my xterm terminals.
I'm curious why this isn't documented in the FAQ? Is there some down-side
to using this technique to make emacs happy?*
Thanks for your thoughts,
--Michael Sheldon
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
Loading...