tmux-plugins / tmux-sensible

basic tmux settings everyone can agree on
MIT License
1.73k stars 90 forks source link

tmux prints chars on session start #61

Open skwde opened 3 years ago

skwde commented 3 years ago

On session start tmux prints 0;10;1c. See also here: https://github.com/microsoft/WSL/issues/5931.

This seems to be related to escape-time. In ~/.tmux.conf

set -sg escape-time 10

fixes the issue for me.

roachsinai commented 3 years ago

Seems it works only for the first time start a Session, if you exit current session and run tmux again, prints chars again.

bruno- commented 3 years ago

Can we somehow identify WSL (with an env var for example) so we can set escape-time 10 just in that case?

roachsinai commented 3 years ago

@bruno- but for my case problem didn't slove by set it prefectly.

bruno- commented 3 years ago

@roachsinai , hm ok, I understand now. Well, I'd be ok with fixing the problem for the first try at least.

Please update this thread if you find a proper solution.

trallnag commented 2 years ago

@roachsinai, is your issue reproducible? For me setting tmux set-option -g escape-time 50 completely fixed the issue and it does not reappear when detaching and attaching to a session.


Edit: I was too eager to announce the issue being solved for me. I have all my config (except declaration of plugins) in a shell script that I call with run-shell and the characters only stop appearing when I place set-option -g escape-time 50 right in front of the run-shell.

avysk commented 1 year ago

I have very much the same issue not in WSL but on FreeBSD 13.1 and FreeBSD 14.0 (ssh-ed in from Windows Terminal). Increasing escape-timeout seems to fix the problem.

tsautumn commented 1 year ago

This reduces the frequency of the problem for me, but does not eliminate it. I'm shelling from Windows 11 into a remote Debian Bullseye bash. I have tried escape-time values of 0, 10, 20, and 50.

niqodea commented 1 year ago

I also have escape-time set to 0 and having this issue in the Windows 11 command prompt SSHing into an Ubuntu server when using tmux version 3.2a and newer.

Interestingly, this problem does not occur in the older version 3.1c.

Setting escape-time to something greater than 0 also works, but I prefer sticking to the older TMUX version at this point. Hoping this issue will be addressed some day 🤞

dsjstc commented 1 year ago

The problem still occurs for me after downgrading to 3.1c on Debian Bullseye.

niqodea commented 10 months ago

I think I might have fixed it. For some reason, setting the environment variable TERM to tmux-256color before attaching to tmux seems to solve the problem for me. I will update this post if this ends up not working. Let me know if it also works for you.

EDIT: thinking about it a bit more, it makes sense that this solves the issue. The terminal is no longer queried for the capabilities by tmux, because tmux already has already been told about the capabilities via TERM.

For reference, this what I put in my .profile to fix it, explain why it works, and the assumption behind it.

Eryx5502 commented 10 months ago

I think I might have fixed it. For some reason, setting the environment variable TERM to tmux-256color before attaching to tmux seems to solve the problem for me. I will update this post if this ends up not working. Let me know if it also works for you.

This does solve the problem also for me (I used to have TERM=xterm-256color, but changes the colours on my nvim theme, which is kind of uncomfortable.

dsjstc commented 10 months ago

Thanks, this works for me too. Great workaround.

henrychea commented 7 months ago

Late to the convo but if you just want to change the TERM for tmux only you can add this to the top of your tmux.conf file

set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",tmux-256color:Tc"

Edit: needs override as well