![Alacritty + tmux はコピーモードでテキストの大部分をコピーできない](https://rvso.com/image/1592511/Alacritty%20%2B%20tmux%20%E3%81%AF%E3%82%B3%E3%83%94%E3%83%BC%E3%83%A2%E3%83%BC%E3%83%89%E3%81%A7%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%81%AE%E5%A4%A7%E9%83%A8%E5%88%86%E3%82%92%E3%82%B3%E3%83%94%E3%83%BC%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84.png)
私は 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 を使用しているので、set -g set-clipboard off で tmux にそれを使用しないように指示できます。競合して問題が発生するため、いずれにしても両方を使用しないでください。
答え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
私にとっては壊すものだった