diff options
author | Jonathan LEI | 2023-09-06 05:01:32 +0000 |
---|---|---|
committer | GitHub | 2023-09-06 05:01:32 +0000 |
commit | 8778083b5a101947fb6d7c359772231a7610bf7a (patch) | |
tree | a0ee9338c131556145466d6e6647ad80e803cf64 /helix-view | |
parent | 48b7520bca0823aad28de9e19080fe5a7ce3b792 (diff) |
Detect tmux clipboard provider on macOS (#8182)
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/clipboard.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-view/src/clipboard.rs b/helix-view/src/clipboard.rs index d639902f..812c803e 100644 --- a/helix-view/src/clipboard.rs +++ b/helix-view/src/clipboard.rs @@ -73,9 +73,14 @@ pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> { #[cfg(target_os = "macos")] pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> { - use crate::env::binary_exists; + use crate::env::{binary_exists, env_var_is_set}; - if binary_exists("pbcopy") && binary_exists("pbpaste") { + if env_var_is_set("TMUX") && binary_exists("tmux") { + command_provider! { + paste => "tmux", "save-buffer", "-"; + copy => "tmux", "load-buffer", "-w", "-"; + } + } else if binary_exists("pbcopy") && binary_exists("pbpaste") { command_provider! { paste => "pbpaste"; copy => "pbcopy"; |