Skip to content

Commit

Permalink
Detect tmux clipboard provider on macOS (#8182)
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI authored Sep 6, 2023
1 parent 48b7520 commit 8778083
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions helix-view/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 8778083

Please sign in to comment.