macOS下Zsh环境中tmux状态栏异常及终端行丢失问题求助
macOS下Zsh环境中tmux状态栏异常及终端行丢失问题求助
各位好,我最近用tmux时碰到两个挺棘手的问题,想请教下有没有朋友知道怎么解决:
- 状态栏会随机变成两行(相关截图如下),甚至有时候直接消失不见
- 终端里的命令行偶尔会出现丢失的情况,比如执行命令时最后一行突然就不见了(也有对应截图)
我当前用Zsh作为默认shell,而且这个问题在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 ..."
麻烦大家帮忙看看问题可能出在哪里,谢谢啦!
备注:内容来源于stack exchange,提问作者ℂybernetician




