I am having this issue for about 2 years now (since I started to use tmux in Summer 2018) and I have not found a solution to this problem. Any help is greatly appreciated!
The copy functionality of tmux is slow. Often times when I copy using mouse selection, and then I paste in the terminal it almost always pastes what I thought was in the clipboard previously, it never copied the current mouse over selection into the clipboard. I have to select and then wait for a bit (usually a second or so).
I am so used to the copy current mouse selection from linux, iTerm2 on macOS and they are blazingly fast, I never have to think about or wait for the selection to be copied.
This causes problems because sometimes my clipboard has sentences and when I mouse over let's say a dir path/filename/git commit hash, etc. and paste in the terminal thinking that a dir path/filename/git commit hash will be pasted, here comes a barrage of sentences.
I have tried a few ways to address this problem none of them to my satisfaction.
I tried to print a message after the copy was done:
bind -T copy-mode-vi Tab send -X copy-pipe "reattach-to-user-namespace pbcopy"\; display-message "copied to system clipboard"
I saw the mistake I was doing with calling reattach-to-use-namespace every time on selection, so instead, I started tmux only once with this program:
set-option -g default-command "reattach-to-user-namespace -l bash" bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "pbcopy" \; display-message "copied to system clipboard"
Later I switched to tmux-plugins/tmux-sensible which starts tmux with reattach-to-user-namespace.
And now a few weeks back I disabled all the bind-key copy configuration and switched to tmux-plugins/tmux-yank. I prefer the tmux-yank configuration better than what I had. But the slowness or delay in copying still persists, I am often pasting the wrong information, thinking the mouse selection is copied into the system clipboard.
I also running updated software as much as possible, hoping to see some improvements. The issue is I do not where the problem is to debug further. Is the slowness in tmux or reattach-to-user-namespace or Alacritty or OS X.
I tried switching back to iTerm2 because this issue was getting annoying but after using Alacritty, iTerm2 is sluggish and slow, as I am streaming a lot logs in the terminal for debugging. And unfortunately Alacritty does not support multi-window mode or tabs at the moment.
Alacritty+tmux on macOS is the perfect solution at the moment for me, except for this once annoyance with the slowness in copy.
I am running:
- tmux
3.1b
- reattach-to-user-namespace
2.8
- alacritty
0.4.2 (f68de37)
- macOS
Catalina 10.15.4
I ran into this https://github.com/alacritty/copypasta, I want to give this a try and see if this improves the situation.
And just for writing this question, I pasted the wrong info many times and had to go back and wait for the copy to properly finish.