mirror of
https://github.com/tmux-plugins/tmux-yank.git
synced 2026-09-10 07:36:17 -04:00
parent
68c5c7ca6f
commit
feb9611b7d
25
README.md
25
README.md
|
|
@ -171,6 +171,31 @@ Configuration
|
|||
- <kbd>Y</kbd> (shift-y) — "put" selection. Equivalent to copying a
|
||||
selection, and pasting it to the command line.
|
||||
|
||||
|
||||
### Default and Preferred Clipboard Programs
|
||||
|
||||
tmux-yank does its best to detect a reasonable choice for a clipboard
|
||||
program on your OS.
|
||||
|
||||
If tmux-yank can't detect a known clipboard program then it uses the
|
||||
`@custom_copy_command` tmux option as your clipboard program if set.
|
||||
|
||||
If you need to always override tmux-yank's choice for a clipboard program,
|
||||
then you can set `@override_copy_command` to force tmux-yank to use whatever
|
||||
you want.
|
||||
|
||||
Note that both programs _must_ accept `STDIN` for the text to be copied.
|
||||
|
||||
An example of setting `@override_copy_command`:
|
||||
|
||||
``` tmux
|
||||
# ~/.tmux.conf
|
||||
|
||||
set -g @custom_copy_command 'my-clipboard-copy --some-arg'
|
||||
# or
|
||||
set -g @override_copy_command 'my-clipboard-copy --some-arg'
|
||||
```
|
||||
|
||||
### Linux Clipboards
|
||||
|
||||
Linux has several cut-and-paste clipboards: `primary`, `secondary`, and
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
custom_copy_command_default=""
|
||||
custom_copy_command_option="@custom_copy_command"
|
||||
|
||||
override_copy_command_default=""
|
||||
override_copy_command_option="@override_copy_command"
|
||||
|
||||
# helper functions
|
||||
get_tmux_option() {
|
||||
local option="$1"
|
||||
|
|
@ -75,6 +78,10 @@
|
|||
custom_copy_command() {
|
||||
get_tmux_option "$custom_copy_command_option" "$custom_copy_command_default"
|
||||
}
|
||||
|
||||
override_copy_command() {
|
||||
get_tmux_option "$override_copy_command_option" "$override_copy_command_default"
|
||||
}
|
||||
# Ensures a message is displayed for 5 seconds in tmux prompt.
|
||||
# Does not override the 'display-time' tmux option.
|
||||
display_message() {
|
||||
|
|
@ -108,7 +115,9 @@
|
|||
|
||||
clipboard_copy_command() {
|
||||
# installing reattach-to-user-namespace is recommended on OS X
|
||||
if command_exists "pbcopy"; then
|
||||
if [ -n "$(override_copy_command)" ]; then
|
||||
override_copy_command
|
||||
elif command_exists "pbcopy"; then
|
||||
if command_exists "reattach-to-user-namespace"; then
|
||||
echo "reattach-to-user-namespace pbcopy"
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue