As of tmux 2.6, bind-key
no longer takes a mode-table option (-t
). Instead, there is a a key-table (-T
) for each mode.
Additionally, commands can't be used directly in copy-mode bindings. They have to be sent with send-keys -X
.
From comments on tmux issue 754:
- replace
-t
with -T
- replace
vi-<name>
with <name>-mode-vi
- prefix the command with
send-keys -X
Furthermore, from version 2.4 onwards, the new command copy-pipe-and-cancel
leaves copy mode, while copy-pipe
keeps it active.
So that line in your tmux.conf
becomes:
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -sel clip -i"
Garbage printed to the screen
Depending on your terminal emulator, you may also see some characters dumped to the screen after using this binding. This is down to the set-clipboard
feature:
Attempt to set the terminal clipboard content using the xterm(1) escape sequence, if there is an Ms entry in the terminfo(5) description (see the TERMINFO EXTENSIONS section).
It appears that some terminals (such as LXTerminal) will set TERM to xterm
(which supports this extension), but don't actually recognise the sequence. copy-pipe
and copy-pipe-and-cancel
will "helpfully" attempt to use this feature, and the terminal simply displays the resulting characters. What you're seeing is the escape sequence followed by the base64-encoding of the selected text.
If your terminal is one that mishandles this escape sequence, you can disable it with
set-option -g set-clipboard off
tmux
sessions after changing this line? Are there any error messages, either whentmux
starts (and reads this line from the config file) or when you use the binding? – JigglyNaga Dec 21 '18 at 16:15set-option -g set-clipboard off
stop the extra characters from appearing? – JigglyNaga Jan 02 '19 at 15:03