diff --git a/tmux.conf b/tmux.conf index efae023..f2deda4 100644 --- a/tmux.conf +++ b/tmux.conf @@ -115,12 +115,14 @@ bind -n WheelDownPane \ \"select-pane -t= ; \ send-keys -M\" " -# Yank to the system clipboard in copy mode +# Yank to the system clipboard in copy mode. +# TODO: reattach-to-user-namespace not necessary with tmux > 2.6 if -b '[ "`uname`" = "Darwin" ]' \ - 'bind -T copy-mode-vi y send-keys -X copy-pipe \ - "reattach-to-user-namespace pbcopy"' \ - 'bind -T copy-mode-vi y send -X copy-pipe \ - "xclip -i -sel p -f | xclip -i -sel c"' + 'bind -T copy-mode-vi y send-keys -X copy-pipe "reattach-to-user-namespace pbcopy"' +# When not in WSL2 use xsel, when in WSL use win32yank.exe to avoid UI lockups. +if -b '[ "$WSLENV" = "" ]' \ + 'bind -T copy-mode-vi y send-keys -X copy-pipe "xsel -i --clipboard"' \ + 'bind -T copy-mode-vi y send-keys -X copy-pipe "win32yank.exe -i -crlf"' # Left status style if -b '[ "$WSL_DISTRO_NAME" != "" ]' \