@bphogan
I am attempting to use the commands at the top of page 59 of the beta 3.0 version of the tmux 3 book.
I get an error on this line:
set -g paste-command "xclip -sel clip -o"'
The error message is:
invalid option: paste-command
I looked at the manual page and while the copy-command
is listed, there is no listing for the paste-command
so it appears that that command doesn’t exist.
I am using Fedora 41 which provides tmux version 3.5a. I think that is the most recent version of tmux.
Please let me know if there is a revised command that takes the place of paste-command
.
Hi @stevenfalco. Thanks for raising this. It looks like I goofed and an old version of the file made its way into the book. 
It’s supposed to use @ variables, not the commands themselves.
Does this work for you?
# Detect the display server protocol and set clipboard commands
if-shell '[ "$XDG_SESSION_TYPE" = "wayland" ]' \
'set -g @copy_command "wl-copy"; \
set -g @paste_command "wl-paste -n"' \
'set -g @copy_command "xclip -sel clip -i"; \
set -g @paste_command "xclip -sel clip -o"'
# Prefix Ctrl-C takes what's in the buffer and sends it to system clipboard
# via the command stored in the variable.
bind C-c run-shell 'tmux save-buffer - | #{@copy_command}'
# y in copy mode takes selection and sends it to system clipboard via the
# command stored in the variable.
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "#{@copy_command}"
# Prefix Ctrl-v fills tmux buffer from system clipboard, then
# pastes from buffer into tmux window
bind C-v run-shell '#{@paste_command} | tmux load-buffer - \; paste-buffer'
Yes - that version works.
Thanks!