From 8003314493b653cb074a00d3b1fb2d972668e8a3 Mon Sep 17 00:00:00 2001 From: Pieter Joost van de Sande Date: Tue, 1 Sep 2015 16:46:44 +0200 Subject: [PATCH] adds clipboard plugin this adds the copy and paste commands --- plugins/clipboard/clipboard.plugin.zsh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugins/clipboard/clipboard.plugin.zsh diff --git a/plugins/clipboard/clipboard.plugin.zsh b/plugins/clipboard/clipboard.plugin.zsh new file mode 100644 index 000000000..f73ea88df --- /dev/null +++ b/plugins/clipboard/clipboard.plugin.zsh @@ -0,0 +1,23 @@ +# pbcopy is expected to be available on Mac OSX +if type pbcopy &> /dev/null; then + alias copy="pbcopy" + alias paste="pbpaste" + +# xsel is expected to be available on most modern XWindows based Linux distro +elif type xsel &> /dev/null; then + alias copy="xsel --clipboard --input" + alias paste="xsel --clipboard --output" + +# xclip is expected to be available on Linux distros that do not ship with xsel +elif type xclip &> /dev/null; then + alias copy="xclip --selection clipboard" + alias paste="xclip --selection clipboard -o" + +else + echo 'No clipboard util found!' + echo 'Please install one of the following utils:' + echo '\tpbcopy' + echo '\txsel' + echo '\txclip' + return 1 +fi