WSL and tmux
After using WSL a while, I became quite annoyed with Windows and tmux not sharing the same copy buffer. In a complete "shot in the dark", I replaced the "reattach-to-user-namespace pbcopy"
command in my tmux config (from my macOS machine) with /mnt/c/Windows/System32/clip.exe
. Surprisingly, it works! Quite well actually.
I use VI bindings in tmux but I assume some variation of the binds below will also work with the default Emacs bindings. Copying to the Windows clipboard via mouse1 drag-and-release is also configured for convenience.
Config snippet
# Configure VI bindings
set-window-option -g mode-keys vi
set -g status-keys vi
# Configure copying
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi Escape send-keys -X cancel
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "/mnt/c/Windows/System32/clip.exe"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "/mnt/c/Windows/System32/clip.exe"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "/mnt/c/Windows/System32/clip.exe"