You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决tmux-resurrect恢复后打印空命令行提示符的问题?

问题描述

在tmux中使用tmux-resurrect和tmux-continuum插件时,自动或手动保存后重启服务器,活动窗口的stdout会打印带命令提示符的空行。初始会出现两行,后续数量会逐渐增多。

例如,有一个两天未使用但其他会话持续运行的窗口,其中空命令提示符被打印了9次;几天后这些空提示符会占满整个屏幕,严重干扰resurrect已启用的窗格内容恢复功能。

假设有会话A、B、C,每个会话各含一个窗口。连续几天仅使用会话A,每次重启tmux服务器,会话A的窗口都会在stdout中打印两个空命令提示符;而从未进入过的会话B、C,则会出现6、7或9个空提示符——目前尚未观察到tmux服务器启动次数与会话B、C中空提示符数量的直接关联,但可以确定数量会随时间推移增多,且并非每次重启都会增加,仅在特定情况下增长。

环境信息
System:
Host: debian Kernel: 6.12.38+deb13-amd64 arch: x86_64 bits: 64
Desktop: Xfce v: 4.20.1 Distro: Debian GNU/Linux 13 (trixie)

tmux.conf配置:

# Use Ctrl-Space as prefix
unbind-key C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix

set -s prefix-timeout 1000
set -g status-style bg=red,fg=white

# make page up/down just work
set -g mouse on
setw -g mode-keys vi
#bind -n PageUp copy-mode -u
#bind -n PageDown send-keys PageDown

# sets zsh as default tmux shell
set-option -g default-shell /bin/zsh

# sets up right status bar
set -g status-right 'Continuum status: #{continuum_status}#{?client_prefix, #[fg=00ff00][PFX],}'
# sets up left status bar to remove [username]
set -g status-left ''

# Format for inactive windows (just the name)
setw -g window-status-format ' #{window_name} '

# Format for the currently active window (styled name)
# Using #[reverse] is a common way to highlight
setw -g window-status-current-format ' #[reverse] #{window_name} '

set -g status-justify centre

# Cyberpunk status bar
set -g status-style bg='#111111',fg='#00ff00'
#set -g status-left '#[fg=#ff00ff,bold]#S #[fg=#00ffff]#I:#P #[default]| '
#set -g status-right '#[fg=#ffff00]%H:%M #[fg=#ff00ff,bold]#H'
set -g window-status-current-style 'fg=#00ff00,bg=#000000,bold'
#set -g window-status-current-format '#I:#W#F'
set -g window-status-style 'fg=#555555,bg=#000000'
#set -g window-status-format '#I:#W#F'


# Plugin options set before initialising them
set -g @continuum-save-interval 15
set -g @continuum-restore 'on'
set -g @resurrect-capture-pane-contents 'on'

##### Always keep this at EOF #####

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-sessionist'

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'

#run-shell ~/Repositories/Misc/tmux-pain-control/pain-control.tmux
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.config/tmux/plugins/tpm/tpm'

内容的提问来源于stack exchange,提问作者Kamil

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 03:14:57