TMUX状态行在VIM中滚动时消失

问题描述 投票:0回答:1

[每当我在VIM中滚动时,tmux状态行都会迅速消失并重新出现。我该怎么做才能解决这个问题?如果我快速滚动到VIM或cat大文件之外,则不会出现此问题。

enter image description here

我的tmux.conf文件:

# Nakrule TMUX configuration

###### PREFERENCES

## Lower the default tmux delay, this makes tmux more responsive.
set -s escape-time 1

# Enable mouse movements.
setw -g mouse on

# Make tmux use 256 colors. Required for VIM to work in 256 colors mode.
set -g default-terminal "screen-256color"

# Make tmux act like xterm to prevent Vim issues:
set -g terminal-overrides 'xterm*:smcup@:rmcup@'

# Only resize the screen size if the smaller screen user has their window
# active. This way my screen won't be resized to an incredibly small window
# unnecessarily.
setw -g aggressive-resize on

# Store a lot of history.
set -g history-limit 10000

# Automatically renumber tmux windows
set-option -g renumber-windows on

# Update status bar every minute
set-option -g status-interval 1

# Enable RGB colour if running in xterm(1)
set-option -sa terminal-overrides ",xterm*:Tc"

# Make pane index start with 1
set-option -g base-index 1

# The window (GUI) title of the terminal will be based on the curent tmux window
set-option -g set-titles on
set-option -g set-titles-string "#T - #W"

# No delay for ESC key
set-option -sg escape-time 0

# Window titles
set-window-option -g  window-status-format "#I #W"
set-window-option -g  window-status-current-format "#I #W"

# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
set-window-option -g aggressive-resize on

# Make window index start with 1
set-window-option -g pane-base-index 1

## VIM mode
set-window-option -g mode-keys vi

############################### MAPPINGS ###############################

# PREFIX r: Instantly reload tmux's configuration file.
bind r source-file ~/.tmux.conf \; display "tmux has been reloaded!"

# PREFIX /: Create a new vertial pane in the same directory.
bind / split-window -h -c "#{pane_current_path}"

# PREFIX -: Create a new horizontal pane in the same directory.
bind - split-window -v -c "#{pane_current_path}"

# Use Vim movement key mappings for switching around between panes.
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# Use Vim movement key mappings (uppercase) for resizing panes.
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

# Can use 'v' and 'y' instead of Enter and Space to select and copy text after CTRL B + [ (like VIM)
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel

##### macOS only, configure text selection and copy with the mouse.
# From this link (Linux solution available here as well):
# https://unix.stackexchange.com/questions/318281/how-to-copy-and-paste-with-a-mouse-with-tmux/318285#318285
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"

### APPEARANCE

# Status update interval
set -g status-interval 1

# Basic status bar colors
set -g status-style bg=black,fg=yellow

# Left side of status bar
set -g status-left-style bg=black,fg=green
set -g status-left-length 40
set -g status-left "#S #[fg=white]» #[fg=yellow]#I #[fg=cyan]#P"

# Right side of status bar
set -g status-right-style bg=black,fg=cyan
set -g status-right-length 40
set -g status-right "#H #[fg=white]« #[fg=yellow]%H:%M:%S #[fg=green]%d-%b-%y"

# Window status
set -g window-status-format " #I:#W#F "
set -g window-status-current-format " #I:#W#F "

# Current window status
set -g window-status-current-style bg=red,fg=white

# Window with activity status
set -g window-status-activity-style bg=black,fg=yellow

# Window separator
set -g window-status-separator ""

# Window status alignment
set -g status-justify centre

# Pane border
set -g pane-border-style bg=default,fg=default

# Active pane border
set -g pane-active-border-style bg=default,fg=green

# Pane number indicator
set -g display-panes-colour default
set -g display-panes-active-colour default

# Clock mode
set -g clock-mode-colour red
set -g clock-mode-style 24

# Message
set -g message-style bg=default,fg=default

# Command message
set -g message-command-style bg=default,fg=default

# Mode
set -g mode-style bg=red,fg=default
vim tmux
1个回答
0
投票

问题来自以下配置:

# Make tmux act like xterm to prevent Vim issues:
set -g terminal-overrides 'xterm*:smcup@:rmcup@'

删除即可解决。

© www.soinside.com 2019 - 2024. All rights reserved.