Getting Copy / Paste to Work in WSL with tmux and Terminal Vim
Getting your system clipboard to work with tmux and Vim can be tricky. Here's a short video showing how to set it all up.
Quick Jump:
By the end of this video you’ll have your clipboard working across all terminal applications, and even be able to copy and paste between a WSL terminal and Windows. Also, if you’re not using WSL most of the video applies to MacOS and native Linux too.
# Demo Video Showing How It Works
Timestamped Table of Contents
- 0:44 – Getting familiar with your terminal
- 1:37 – Copy / pasting text in your terminal
- 2:17 – Copying text with tmux using the mouse
- 3:08 – Configuring tmux to copy text with the mouse
- 4:46 – Demonstrating why tmux-yank is so useful
- 6:21 – Avoiding shift select to copy text with multiple tmux panes
- 7:39 – Demonstrating the same shift select problem with Vim
- 8:50 – Configuring Vim to use the system clipboard for yanking and pasting
- 12:35 – Setting up VcXsrv to link your WSL and Windows clipboard
- 15:06 – Getting VcXsrv to start when Windows boots up
Reference Links
- wsltty: https://github.com/mintty/wsltty
- tmux: https://github.com/tmux/tmux
- tmux-yank: https://github.com/tmux-plugins/tmux-yank
- Dotfiles: https://github.com/nickjj/dotfiles
- VcXsrv: https://sourceforge.net/projects/vcxsrv/
Were you able to get everything working? Let me know below.