From faa4fab7c0cdcebe9e86cfa0084f293fe75e873c Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 12 Dec 2014 00:01:10 -0800 Subject: [PATCH] Don't call in to xclip when $DISPLAY isn't available. --- dotfiles/lib/shellenv/functions.sh | 2 +- dotfiles/lib/zsh/system-wide-clipboard.zsh | 12 ++++++------ dotfiles/tmux.conf | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dotfiles/lib/shellenv/functions.sh b/dotfiles/lib/shellenv/functions.sh index 7bdd4306..7609739a 100644 --- a/dotfiles/lib/shellenv/functions.sh +++ b/dotfiles/lib/shellenv/functions.sh @@ -121,7 +121,7 @@ function oscopy() { then reattach-to-user-namespace pbcopy else - xclip -selection c + test -n "$DISPLAY" && xclip -selection c fi } diff --git a/dotfiles/lib/zsh/system-wide-clipboard.zsh b/dotfiles/lib/zsh/system-wide-clipboard.zsh index 65535fa7..c5116182 100644 --- a/dotfiles/lib/zsh/system-wide-clipboard.zsh +++ b/dotfiles/lib/zsh/system-wide-clipboard.zsh @@ -1,32 +1,32 @@ pb-kill-line () { zle kill-line - echo -n $CUTBUFFER | clipboard + echo -n $CUTBUFFER | oscopy } pb-kill-whole-line () { zle kill-whole-line - echo -n $CUTBUFFER | clipboard + echo -n $CUTBUFFER | oscopy } pb-backward-kill-word () { zle backward-kill-word - echo -n $CUTBUFFER | clipboard + echo -n $CUTBUFFER | oscopy } pb-kill-word () { zle kill-word - echo -n $CUTBUFFER | clipboard + echo -n $CUTBUFFER | oscopy } pb-kill-buffer () { zle kill-buffer - echo -n $CUTBUFFER | clipboard + echo -n $CUTBUFFER | oscopy } pb-copy-region-as-kill-deactivate-mark () { zle copy-region-as-kill zle set-mark-command -n -1 - echo -n $CUTBUFFER | clipboard + echo -n $CUTBUFFER | oscopy } pb-yank () { diff --git a/dotfiles/tmux.conf b/dotfiles/tmux.conf index f8690686..24f87a45 100644 --- a/dotfiles/tmux.conf +++ b/dotfiles/tmux.conf @@ -24,5 +24,5 @@ bind-key / resize-pane -L 3 bind-key - resize-pane -U 3 bind-key * resize-pane -R 3 -bind-key -t emacs-copy M-w copy-pipe "zsh -c 'clipboard'" +bind-key -t emacs-copy M-w copy-pipe "zsh -c 'oscopy'" source ~/.tmux.powerline \ No newline at end of file