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
b6d78df6
Commit
b6d78df6
authored
Oct 04, 2015
by
Andrew Janke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clip*: add xsel support
parent
e4fdb083
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
13 deletions
+32
-13
clipboard.zsh
lib/clipboard.zsh
+32
-13
No files found.
lib/clipboard.zsh
View file @
b6d78df6
...
@@ -31,16 +31,22 @@ function clipcopy() {
...
@@ -31,16 +31,22 @@ function clipcopy() {
cat
$file
>
/dev/clipboard
cat
$file
>
/dev/clipboard
fi
fi
else
else
which xclip &>/dev/null
if
which xclip &>/dev/null
;
then
if
[[
$?
!=
0
]]
;
then
print
"clipcopy: Platform
$OSTYPE
not supported or xclip not installed"
>
&2
return
1
fi
if
[[
-z
$file
]]
;
then
if
[[
-z
$file
]]
;
then
xclip
-in
-selection
clipboard
xclip
-in
-selection
clipboard
else
else
xclip
-in
-selection
clipboard
$file
xclip
-in
-selection
clipboard
$file
fi
fi
elif
which xsel &>/dev/null
;
then
if
[[
-z
$file
]]
;
then
xsel
--clipboard
--input
else
cat
"
$file
"
| xsel
--clipboard
--input
fi
else
print
"clipcopy: Platform
$OSTYPE
not supported or xclip/xsel not installed"
>
&2
return
1
fi
fi
fi
}
}
...
@@ -50,6 +56,17 @@ function clipcopy() {
...
@@ -50,6 +56,17 @@ function clipcopy() {
#
#
# clippaste - writes clipboard's contents to stdout
# clippaste - writes clipboard's contents to stdout
#
#
# clippaste | <command> - pastes contents and pipes it to another process
#
# clippaste > <file> - paste contents to a file
#
# Examples:
#
# # Pipe to another process
# clippaste | grep foo
#
# # Paste to a file
# clippaste > file.txt
function
clippaste
()
{
function
clippaste
()
{
emulate
-L
zsh
emulate
-L
zsh
if
[[
$OSTYPE
==
darwin
*
]]
;
then
if
[[
$OSTYPE
==
darwin
*
]]
;
then
...
@@ -57,11 +74,13 @@ function clippaste() {
...
@@ -57,11 +74,13 @@ function clippaste() {
elif
[[
$OSTYPE
==
cygwin
*
]]
;
then
elif
[[
$OSTYPE
==
cygwin
*
]]
;
then
cat
/dev/clipboard
cat
/dev/clipboard
else
else
which xclip &>/dev/null
if
which xclip &>/dev/null
;
then
if
[[
$?
!=
0
]]
;
then
xclip
-out
-selection
clipboard
print
"clipcopy: Platform
$OSTYPE
not supported or xclip not installed"
>
&2
elif
which xsel &>/dev/null
;
then
xsel
--clipboard
--output
else
print
"clipcopy: Platform
$OSTYPE
not supported or xclip/xsel not installed"
>
&2
return
1
return
1
fi
fi
xclip
-out
-selection
clipboard
fi
fi
}
}
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