All,
Vim has compiled-in knowledge of a few terminals whose mouse
support is like that of xterm. One such terminal is GNU screen.
Missing from this list is tmux, a terminal multiplexer similar
to GNU screen:
https://tmux.github.io/
When ``$TERM`` is ``screen``, Vim automatically performs the
equivalent of ``:set ttymouse=xterm``; when ``$TERM`` is
``tmux``, ``ttymouse`` is left unset which causes the following
incorrect mouse-related settings to be set:
<DecMouse> ^[[
<NetMouse> ^[}
<Mouse> ^[MG
<DecMouse> in particular interferes with the processing of
key codes that start with ``^[[``.
I'd like to propose the below patch which adds supports for tmux
in the same way that Vim currently supports screen.
diff --git a/src/os_unix.c b/src/os_unix.c
index 5f1c487..f12e944 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2261,6 +2261,7 @@ use_xterm_like_mouse(char_u *name)
return (name != NULL
&& (term_is_xterm
|| STRNICMP(name, "screen", 6) == 0
+ || STRNICMP(name, "tmux", 4) == 0
|| STRICMP(name, "st") == 0
|| STRNICMP(name, "st-", 3) == 0
|| STRNICMP(name, "stterm", 6) == 0));
Thanks,
Michael Henry