zsh 和 MacOS 中的 tmux 状态栏和终端行错误

zsh 和 MacOS 中的 tmux 状态栏和终端行错误

我的 tmux 有一个 bug。状态栏会随机变成两行(见下图)或完全消失。

Tmux 状态栏错误

此外,终端命令的某些行也消失了。参见下图,最后一行消失了。

线条消失

有人知道如何解决这个问题吗?

我正在使用 zsh,iTerm2 和 Kitty 中也出现了同样的问题。

顺便说一下,这是我的 tmux 配置:

# Window [2]
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# reload config file (change file location to your the tmux.conf you want to use) [2]
bind r source-file ~/.tmux.conf

# Enable mouse mode (tmux 2.1 and above) [2,4,5]
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -T copy-mode-vi    C-WheelUpPane   send-keys -X halfpage-up
bind -T copy-mode-vi    C-WheelDownPane send-keys -X halfpage-down
bind -T copy-mode-emacs C-WheelUpPane   send-keys -X halfpage-up
bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down

# To copy, left click and drag to highlight text in yellow, 
# once you release left click yellow text will disappear and will automatically be available in clibboard
# # Use vim keybindings in copy mode
setw -g mode-keys vi
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"

# Set zsh as default shell in tmux [6]
set-option -g default-shell /bin/zsh


# switch panes using Alt-arrow without prefix [2]
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# Weather [3]
set -g status-interval 60
WEATHER='#(curl -s wttr.in/Sydney\?format\="%%l:+%%c%%20%%t%%60%%w&period=60")'
set -g status-right "$WEATHER ..."

# References 

# [1] https://gist.github.com/michaellihs/b6d46fa460fa5e429ea7ee5ff8794b96
# [2] https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# [3] https://github.com/chubin/wttr.in#one-line-output
# [4] https://superuser.com/questions/209437/how-do-i-scroll-in-tmux
# [5] https://unix.stackexchange.com/questions/318281/how-to-copy-and-paste-with-a-mouse-with-tmux
# [6] https://superuser.com/questions/253786/how-can-i-make-tmux-use-my-default-shell

相关内容