You are not logged in.

#1 2021-03-14 04:07:56

k395
Member
Registered: 2020-01-29
Posts: 37

[SOLVED] Why are control+left/right so hard to use in tmux?

My main annoyance with tmux is that
control+left/right doesn't work correctly out of the box.

If I understood correctly from this answer https://unix.stackexchange.com/a/34723,
it's because of a limitation in "`screen`-based terminfo database entries"
(which if I understood correctly, is the `/usr/share/terminfo/s/screen` file,
and can be viewed with `infocmp screen`)
. Therefore programs like `vim` must be manually configured.


* Why can't tmux use another "terminfo database entries"? Like the one of xterm?
Is it just too hard to implement, or is there a technical limitation?
* But why is it not defined, while `screen`-like programs definitely does support it?
Can it be manually defined?

======

`set-window-option -g xterm-keys on` doesn't change the broken behavior in vim.

Last edited by k395 (2021-03-15 01:09:27)

Offline

#2 2021-03-14 04:47:05

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Why are control+left/right so hard to use in tmux?

Works fine for me (binding those combinations). What term are you using in tmux?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2021-03-14 10:01:18

k395
Member
Registered: 2020-01-29
Posts: 37

Re: [SOLVED] Why are control+left/right so hard to use in tmux?

Tmux in xterm.

What do you mean by "binding those combinations"? Edit vimrc?

======

I forgot to explain that control+left/right only fail in vim, it works in `TERM=xterm vim` (although I think this is a coincidence, because tmux should send key codes defined in screen terminfo. If I understood correctly, `xterm-keys` only make tmux send xterm-style escape codes, not escape codes identical to xterm). And it works in `bash` too (although home/end fails in `TERM=xterm bash`)

Last edited by k395 (2021-03-14 10:04:34)

Offline

#4 2021-03-14 13:09:20

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

Re: [SOLVED] Why are control+left/right so hard to use in tmux?

https://wiki.archlinux.org/index.php/Tm … rrect_term

What does your $TERM say if you don't set it to xterm?

Offline

#5 2021-03-14 13:30:47

k395
Member
Registered: 2020-01-29
Posts: 37

Re: [SOLVED] Why are control+left/right so hard to use in tmux?

Good point.

Unfortunately it doesn't work. Both `TERM=tmux vim --clean` and `TERM=tmux-256color vim --clean` have the same corrupted behavior with control+left/right, with or without `xterm-keys`.

Offline

#6 2021-03-14 13:55:01

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

Re: [SOLVED] Why are control+left/right so hard to use in tmux?

Did you add the terminfo from the wiki?

Offline

#7 2021-03-14 15:08:28

k395
Member
Registered: 2020-01-29
Posts: 37

Re: [SOLVED] Why are control+left/right so hard to use in tmux?

... Okay, it works now.
I still don't understand why tmux doesn't send xterm's default escape sequences.

As an excuse, most answers I found on stackoverflow.com/Unix SE are terrible, scattered around with several very similar questions, and doesn't explain what is going on.

A new question that arises: Why default `$TERM` in xterm is `xterm` rather than `xterm-256color`? It definitely does support 256 color.
... actually https://wiki.archlinux.org/index.php/Xterm does explain it, but why is it not the default?
I get that you should expect to have to do a lot of configuration with this operating system, but isn't it better to have a sensible default...

Offline

#8 2021-03-14 15:49:28

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

Re: [SOLVED] Why are control+left/right so hard to use in tmux?

Because tmux isn't xterm and the client (vim) talks to tmux, not xterm.
tmux *could* run in an xterm, but you could kill that xterm and connect to tmux (w/ the still running vim) from the console or putty next and then what?

About the termName default, arch ships the unaltered upstream app-defaults.
The value is likely conservative because of compatibility concerns, but idk.
https://invisible-island.net/xterm/xter … m_terminfo

Offline

Board footer

Powered by FluxBB