diff --git a/utilities/utilities.plugin.zsh b/utilities/utilities.plugin.zsh index 946c3da..2806225 100644 --- a/utilities/utilities.plugin.zsh +++ b/utilities/utilities.plugin.zsh @@ -2,6 +2,25 @@ autoload colors && colors +# Abstract different ways to copy to the clipboard. +if [ -n "$SSH_CONNECTION" ] ; then + # Use OSC-52 to set the clipboard + alias copy='base64 | xargs -0 printf "\033]52;c;%s\a"' +elif [ "`uname`" = "Darwin" ]; then + # Use pbcopy to set the clipboard + alias copy='pbcopy' +elif which xclip &> /dev/null; then + # Use xclip to set the clipboard + alias copy='xclip -selection c' +fi + +# Abstract different ways to paste from the clipboard. +if [ "`uname`" = "Darwin" ]; then + alias paste='pbpaste' +elif which xclip &> /dev/null; then + alias paste='xclip -selection c -o' +fi + # Detect the type and extract an archive file. extract() { if [ -f $1 ]; then