Alacritty + tmux 无法在复制模式下复制大量文本

Alacritty + tmux 无法在复制模式下复制大量文本

我在 MacOS 上的 alacritty 中使用 tmux + zsh。当我将 tmux 切换到复制模式,选择一大段文本并按下 时y,这段文本不在我的缓冲区中,我无法粘贴它。但在 iTerm 中它可以工作。这是我的tmux.conf

setw -g mode-keys vi
set -g default-terminal screen-256color

# bind y key in copy mode to select and copy to system clipboard
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and- 
cancel "reattach-to-user-namespace pbcopy"

# bind ctrl+v to paste in tmux
bind-key -n C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; 
tmux paste-buffer"

# smart pane switching with awareness of vim splits
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
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)
bind r source-file ~/.tmux.conf

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-yank'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]/user/plugin'
# set -g @plugin '[email protected]/user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

答案1

我认为 alacritty 在使用 OSC 52 设置剪贴板时有长度限制,但由于您使用的是 tmux-yank,因此您可以告诉 tmux 不要在 set -g set-clipboard off 的情况下使用它。无论如何,您都不应该同时使用它们,因为它们会发生竞争并导致问题。

答案2

以下是 2022 年我在 Mac/Alacritty/Tmux 上所做的工作:

setw -g mode-keys vi
set -g set-clipboard off
bind-key -T copy-mode-vi v send-keys -X begin-selection
# bind y key in copy mode to select and copy to system clipboard
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"

也就是说,这reattach-to-user-namespace对我来说是打破了

相关内容