Copy text from one tmux pane to another (using vim)
You'll have to use tmux shortcuts. Assuming your tmux command shortcut is the default: Ctrl+b, then:
Ctrl+b, [ Enter copy(?) mode.
Move to start/end of text to highlight.
Ctrlspace
Start highlighting text (on Arch Linux). When I've compiled tmux from source on OSX and other Linux's, just Space on its own usually works. Selected text changes the colours, so you'll know if the command worked.
Move to opposite end of text to copy.
Alt+w Copies selected text into tmux clipboard. (On Mac use Esc+w.)
Move cursor to opposite tmux pane, or completely different tmux window. Put the cursor where you want to paste the text you just copied.
Ctrl+b, ] Paste copied text from tmux clipboard.
tmux is quite good at mapping commands to custom keyboard shortcuts.
See Ctrl+b,? for the full list of set keyboard shortcuts.
Unfortunately, I can't add a comment yet to Alex Leach's answer so I'm going to include an addendum here for Mac OS X users:
- Enter Copies the selected text
If you are using vim and tmux on macOS (Tested on macOS 10.12.2, tmux 2.3):
(Assume that prefix key combination of tmux is prefix. The prefix is ctrl + b in defaults.)
- Copy:
- Press prefix + [ to enter copy mode.
- Use arrow keys to go to the start/end of text selection.
- Press ctrl + space (If you have set ctrl + space as prefix, Press ctrl + space + space instead)
- Use arrow keys to move to the other side of selection.
- Press ctrl + w.
- Paste:
- Press prefix + ] in insert mode.