File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,31 @@ Configuration
171
171
- <kbd>Y</kbd> (shift-y) — "put" selection. Equivalent to copying a
172
172
selection, and pasting it to the command line.
173
173
174
+
175
+ ### Default and Preferred Clipboard Programs
176
+
177
+ tmux-yank does its best to detect a reasonable choice for a clipboard
178
+ program on your OS.
179
+
180
+ If tmux-yank can' t detect a known clipboard program then it uses the
181
+ ` @custom_copy_command` tmux option as your clipboard program if set.
182
+
183
+ If you need to always override tmux-yank' s choice for a clipboard program,
184
+ then you can set `@override_copy_command` to force tmux-yank to use whatever
185
+ you want.
186
+
187
+ Note that both programs _must_ accept `STDIN` for the text to be copied.
188
+
189
+ An example of setting `@override_copy_command`:
190
+
191
+ ``` tmux
192
+ # ~/.tmux.conf
193
+
194
+ set -g @custom_copy_command ' my-clipboard-copy --some-arg'
195
+ # or
196
+ set -g @override_copy_command ' my-clipboard-copy --some-arg'
197
+ ```
198
+
174
199
### Linux Clipboards
175
200
176
201
Linux has several cut-and-paste clipboards: `primary`, `secondary`, and
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ shell_mode_option="@shell_mode"
27
27
custom_copy_command_default=" "
28
28
custom_copy_command_option=" @custom_copy_command"
29
29
30
+ override_copy_command_default=" "
31
+ override_copy_command_option=" @override_copy_command"
32
+
30
33
# helper functions
31
34
get_tmux_option () {
32
35
local option=" $1 "
@@ -75,6 +78,10 @@ shell_mode() {
75
78
custom_copy_command () {
76
79
get_tmux_option " $custom_copy_command_option " " $custom_copy_command_default "
77
80
}
81
+
82
+ override_copy_command () {
83
+ get_tmux_option " $override_copy_command_option " " $override_copy_command_default "
84
+ }
78
85
# Ensures a message is displayed for 5 seconds in tmux prompt.
79
86
# Does not override the 'display-time' tmux option.
80
87
display_message () {
@@ -108,7 +115,9 @@ command_exists() {
108
115
109
116
clipboard_copy_command () {
110
117
# installing reattach-to-user-namespace is recommended on OS X
111
- if command_exists " pbcopy" ; then
118
+ if [ -n " $( override_copy_command) " ]; then
119
+ override_copy_command
120
+ elif command_exists " pbcopy" ; then
112
121
if command_exists " reattach-to-user-namespace" ; then
113
122
echo " reattach-to-user-namespace pbcopy"
114
123
else
You can’t perform that action at this time.
0 commit comments