mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Split out the copy to clipboard functionality into its own function. It is universally useful.
This commit is contained in:
parent
02c31f1515
commit
e733352ff1
2 changed files with 11 additions and 7 deletions
10
lib/clipboard.zsh
Normal file
10
lib/clipboard.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# function to send text to primary and secondary clipboards
|
||||||
|
sendtoclip() {
|
||||||
|
if (( $+commands[xclip] )); then
|
||||||
|
echo -n $@ | xclip -sel primary
|
||||||
|
echo -n $@ | xclip -sel clipboard
|
||||||
|
elif (( $+commands[xsel] )); then
|
||||||
|
echo -n $@ | xsel -ip # primary
|
||||||
|
echo -n $@ | xsel -ib # clipboard
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
@ -67,11 +67,5 @@ sprunge() {
|
||||||
[[ ! -t 1 ]] && return 0
|
[[ ! -t 1 ]] && return 0
|
||||||
|
|
||||||
# copy urls to primary and secondary clipboards
|
# copy urls to primary and secondary clipboards
|
||||||
if (( $+commands[xclip] )); then
|
sendtoclip $urls
|
||||||
echo -n $urls | xclip -sel primary
|
|
||||||
echo -n $urls | xclip -sel clipboard
|
|
||||||
elif (( $+commands[xsel] )); then
|
|
||||||
echo -n $urls | xsel -ip # primary
|
|
||||||
echo -n $urls | xsel -ib # clipboard
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue