copyfile.plugin.zsh
369 bytes
1# Copies the contents of a given file to the system or X Windows clipboard
2#
3# Usage: copyfile <file>
4function copyfile {
5 emulate -L zsh
6
7 if [[ -z "$1" ]]; then
8 echo "Usage: copyfile <file>"
9 return 1
10 fi
11
12 if [[ ! -f "$1" ]]; then
13 echo "Error: '$1' is not a valid file."
14 return 1
15 fi
16
17 clipcopy $1
18 echo ${(%):-"%B$1%b copied to clipboard."}
19}