Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
39573125
Unverified
Commit
39573125
authored
Jun 19, 2022
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(lib): wait for input to copy to the clipboard (#10953)
parent
4506210c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
clipboard.zsh
lib/clipboard.zsh
+9
-9
No files found.
lib/clipboard.zsh
View file @
39573125
...
@@ -52,37 +52,37 @@ function detect-clipboard() {
...
@@ -52,37 +52,37 @@ function detect-clipboard() {
emulate
-L
zsh
emulate
-L
zsh
if
[[
"
${
OSTYPE
}
"
==
darwin
*
]]
&&
((
${
+commands[pbcopy]
}
))
&&
((
${
+commands[pbpaste]
}
))
;
then
if
[[
"
${
OSTYPE
}
"
==
darwin
*
]]
&&
((
${
+commands[pbcopy]
}
))
&&
((
${
+commands[pbpaste]
}
))
;
then
function
clipcopy
()
{
pbcopy <
"
${
1
:-
/dev/stdin
}
"
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
| pbcopy
;
}
function
clippaste
()
{
pbpaste
;
}
function
clippaste
()
{
pbpaste
;
}
elif
[[
"
${
OSTYPE
}
"
==
(
cygwin|msys
)
*
]]
;
then
elif
[[
"
${
OSTYPE
}
"
==
(
cygwin|msys
)
*
]]
;
then
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
>
/dev/clipboard
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
>
/dev/clipboard
;
}
function
clippaste
()
{
cat
/dev/clipboard
;
}
function
clippaste
()
{
cat
/dev/clipboard
;
}
elif
[
-n
"
${
WAYLAND_DISPLAY
:-}
"
]
&&
((
${
+commands[wl-copy]
}
))
&&
((
${
+commands[wl-paste]
}
))
;
then
elif
[
-n
"
${
WAYLAND_DISPLAY
:-}
"
]
&&
((
${
+commands[wl-copy]
}
))
&&
((
${
+commands[wl-paste]
}
))
;
then
function
clipcopy
()
{
wl-copy <
"
${
1
:-
/dev/stdin
}
"
&>/dev/null &|
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
| wl-copy
&>/dev/null &|
;
}
function
clippaste
()
{
wl-paste
;
}
function
clippaste
()
{
wl-paste
;
}
elif
[
-n
"
${
DISPLAY
:-}
"
]
&&
((
${
+commands[xclip]
}
))
;
then
elif
[
-n
"
${
DISPLAY
:-}
"
]
&&
((
${
+commands[xclip]
}
))
;
then
function
clipcopy
()
{
xclip
-in
-selection
clipboard <
"
${
1
:-
/dev/stdin
}
"
&>/dev/null &|
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
| xclip
-selection
clipboard
-in
&>/dev/null &|
;
}
function
clippaste
()
{
xclip
-out
-selection
clipboard
;
}
function
clippaste
()
{
xclip
-out
-selection
clipboard
;
}
elif
[
-n
"
${
DISPLAY
:-}
"
]
&&
((
${
+commands[xsel]
}
))
;
then
elif
[
-n
"
${
DISPLAY
:-}
"
]
&&
((
${
+commands[xsel]
}
))
;
then
function
clipcopy
()
{
xsel
--clipboard
--input
<
"
${
1
:-
/dev/stdin
}
"
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
| xsel
--clipboard
--input
;
}
function
clippaste
()
{
xsel
--clipboard
--output
;
}
function
clippaste
()
{
xsel
--clipboard
--output
;
}
elif
((
${
+commands[lemonade]
}
))
;
then
elif
((
${
+commands[lemonade]
}
))
;
then
function
clipcopy
()
{
lemonade copy <
"
${
1
:-
/dev/stdin
}
"
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
| lemonade copy
;
}
function
clippaste
()
{
lemonade
paste
;
}
function
clippaste
()
{
lemonade
paste
;
}
elif
((
${
+commands[doitclient]
}
))
;
then
elif
((
${
+commands[doitclient]
}
))
;
then
function
clipcopy
()
{
doitclient wclip <
"
${
1
:-
/dev/stdin
}
"
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
| doitclient wclip
;
}
function
clippaste
()
{
doitclient wclip
-r
;
}
function
clippaste
()
{
doitclient wclip
-r
;
}
elif
((
${
+commands[win32yank]
}
))
;
then
elif
((
${
+commands[win32yank]
}
))
;
then
function
clipcopy
()
{
win32yank
-i
<
"
${
1
:-
/dev/stdin
}
"
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
| win32yank
-i
;
}
function
clippaste
()
{
win32yank
-o
;
}
function
clippaste
()
{
win32yank
-o
;
}
elif
[[
$OSTYPE
==
linux-android
*
]]
&&
((
$+
commands[termux-clipboard-set]
))
;
then
elif
[[
$OSTYPE
==
linux-android
*
]]
&&
((
$+
commands[termux-clipboard-set]
))
;
then
function
clipcopy
()
{
termux-clipboard-set <
"
${
1
:-
/dev/stdin
}
"
;
}
function
clipcopy
()
{
cat
"
${
1
:-
/dev/stdin
}
"
| termux-clipboard-set
;
}
function
clippaste
()
{
termux-clipboard-get
;
}
function
clippaste
()
{
termux-clipboard-get
;
}
elif
[
-n
"
${
TMUX
:-}
"
]
&&
((
${
+commands[tmux]
}
))
;
then
elif
[
-n
"
${
TMUX
:-}
"
]
&&
((
${
+commands[tmux]
}
))
;
then
function
clipcopy
()
{
tmux load-buffer
"
${
1
:-
-
}
"
;
}
function
clipcopy
()
{
tmux load-buffer
"
${
1
:-
-
}
"
;
}
function
clippaste
()
{
tmux save-buffer -
;
}
function
clippaste
()
{
tmux save-buffer -
;
}
elif
[[
$(
uname
-r
)
=
*
icrosoft
*
]]
;
then
elif
[[
$(
uname
-r
)
=
*
icrosoft
*
]]
;
then
function
clipcopy
()
{
c
lip.exe <
"
${
1
:-
/dev/stdin
}
"
;
}
function
clipcopy
()
{
c
at
"
${
1
:-
/dev/stdin
}
"
| clip.exe
;
}
function
clippaste
()
{
powershell.exe
-noprofile
-command
Get-Clipboard
;
}
function
clippaste
()
{
powershell.exe
-noprofile
-command
Get-Clipboard
;
}
else
else
function
_retry_clipboard_detection_or_fail
()
{
function
_retry_clipboard_detection_or_fail
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment