This change allows vim to get Focused Gained/Lost events when running with TERM set to tmux or tmux-256color. These values must be used under tmux per their FAQ:
PLEASE NOTE: most display problems are due to incorrect TERM! Before
reporting problems make SURE that TERM settings are correct inside and
outside tmux.Inside tmux TERM must be "screen", "tmux" or similar (such as
"tmux-256color"). Don't bother reporting problems where it isn't!Outside, it should match your terminal: particularly, use "rxvt" for rxvt
and derivatives.
$ uname -a
Linux ip-172-16-0-117 5.10.0-10-cloud-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux
https://github.com/vim/vim/pull/9558
(1 file)
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
The issue is that it would make Vim treat any terminal as xterm-compatible as soon as we run tmux inside. Personally, I wouldn't mind, but I don't think this will be merged, because the outer terminal might not be xterm-compatible. I could be wrong though; we'll see.
Possible relevant issue: Allow overriding vim_is_xterm from an option at runtime.
In the meantime, you can get the focus events inside tmux, by adding these lines in your vimrc:
" Enable focus event tracking, see :help xterm-focus-event
let &t_fe = "\<Esc>[?1004h"
let &t_fd = "\<Esc>[?1004l"
execute "set <FocusGained>=\<Esc>[I"
execute "set <FocusLost>=\<Esc>[O"
I've always wondered whether in tmux (i.e. when $TMUX is not empty), Vim could internally start some kind of job to ask tmux the real name of the outer terminal:
$ tmux display-message -p '#{outer_terminal}'
Only upon receiving the answer, vim_is_xterm() would then be called.
Pseudo-code in Vim script:
vim9script def OutCb(_, outer_terminal: string): bool if vim_is_xterm(outer_terminal) return true endif return false enddef job_start('tmux display-message -p #{client_termname}', {out_cb: OutCb})
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
In the meantime, you can get the focus events inside tmux, by adding these lines in your vimrc:
" Enable focus event tracking, see :help xterm-focus-event let &t_fe = "\<Esc>[?1004h" let &t_fd = "\<Esc>[?1004l" execute "set <FocusGained>=\<Esc>[I" execute "set <FocusLost>=\<Esc>[O"
@lacygoill Thank you so much for this info! I guess the :help tmux-integration section is less than a year old, and I hadn't seen it before.
And you're right, the fix I proposed isn't completely general, since it assumes the outer terminal is xterm compatible.
Closing this PR.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Closed #9558.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
tmux is a bit of a problem, since it is a layer on top of a terminal. We already have "screen.xterm", perhaps "tmux.xterm" would work too? I guess we might then also need to support other terminals after "tmux", such as "tmux.kterm".
What we really need is an overhaul of the whole termcap/terminfo mechanism.
—
Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()