diff options
author | Robby Russell <robby@planetargon.com> | 2015-10-09 07:15:53 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2015-10-09 07:15:53 -0700 |
commit | dc06e96e9cf52354ac76e9795cc85d528b2d5018 (patch) | |
tree | 6cdc6ba4794dffe2cb2189d77cee88ce784e8eb5 /plugins | |
parent | b1173d4b30930cdbd69f8c0c029b94f756fe9be7 (diff) | |
parent | b6d78df62c540245f67ffc900d0b1a17a6dfb77e (diff) | |
download | zsh-dc06e96e9cf52354ac76e9795cc85d528b2d5018.tar.gz zsh-dc06e96e9cf52354ac76e9795cc85d528b2d5018.tar.bz2 zsh-dc06e96e9cf52354ac76e9795cc85d528b2d5018.zip |
Merge pull request #4254 from apjanke/copyfile-portability
Cross-platform clipboard clipcopy() and clippaste()
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/coffee/coffee.plugin.zsh | 10 | ||||
-rw-r--r-- | plugins/copydir/copydir.plugin.zsh | 6 | ||||
-rw-r--r-- | plugins/copyfile/copyfile.plugin.zsh | 8 |
3 files changed, 14 insertions, 10 deletions
diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh index 4e98e0228..77cb663f7 100644 --- a/plugins/coffee/coffee.plugin.zsh +++ b/plugins/coffee/coffee.plugin.zsh @@ -6,11 +6,11 @@ cf () { } # compile & copy to clipboard cfc () { - cf "$1" | pbcopy + cf "$1" | clipcopy } -# compile from pasteboard & print -alias cfp='coffeeMe "$(pbpaste)"' +# compile from clipboard & print +alias cfp='coffeeMe "$(clippaste)"' -# compile from pasteboard and copy to clipboard -alias cfpc='cfp | pbcopy' +# compile from clipboard and copy to clipboard +alias cfpc='cfp | clipcopy' diff --git a/plugins/copydir/copydir.plugin.zsh b/plugins/copydir/copydir.plugin.zsh index 37bb5e086..c45106240 100644 --- a/plugins/copydir/copydir.plugin.zsh +++ b/plugins/copydir/copydir.plugin.zsh @@ -1,3 +1,5 @@ +# Copies the pathname of the current directory to the system or X Windows clipboard function copydir { - pwd | tr -d "\r\n" | pbcopy -}
\ No newline at end of file + emulate -L zsh + print -n $PWD | clipcopy +} diff --git a/plugins/copyfile/copyfile.plugin.zsh b/plugins/copyfile/copyfile.plugin.zsh index 944a903c6..f4eca5acf 100644 --- a/plugins/copyfile/copyfile.plugin.zsh +++ b/plugins/copyfile/copyfile.plugin.zsh @@ -1,5 +1,7 @@ +# Copies the contents of a given file to the system or X Windows clipboard +# +# copyfile <file> function copyfile { - [[ "$#" != 1 ]] && return 1 - local file_to_copy=$1 - cat $file_to_copy | pbcopy + emulate -L zsh + clipcopy $1 } |