From 12c07f15e37897d8fcaab1cb03c2b3ebb4136b46 Mon Sep 17 00:00:00 2001
From: unbalancedparentheses <federico.carrone@gmail.com>
Date: Sun, 1 Feb 2015 19:18:16 +0000
Subject: [PATCH] added pbcopy plugin

---
 plugins/README.md          |  1 +
 plugins/pbcopy/README.md   | 38 ++++++++++++++++++++++++++++++++++++++
 plugins/pbcopy/pbcopy.fish |  7 +++++++
 3 files changed, 46 insertions(+)
 create mode 100644 plugins/pbcopy/README.md
 create mode 100644 plugins/pbcopy/pbcopy.fish

diff --git a/plugins/README.md b/plugins/README.md
index 92fd6d6..77cafee 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -22,6 +22,7 @@
 * [__msg__](https://github.com/bpinto/oh-my-fish/tree/master/plugins/msg) - A technicolor message printer. A colorful alternative to echo.
 * [__ndenv__](https://github.com/bpinto/oh-my-fish/tree/master/plugins/ndenv) – Helpers for [another node.js version manager](https://github.com/riywo/ndenv).
 * [__node__](https://github.com/bpinto/oh-my-fish/tree/master/plugins/node) – Adds locally installed NodeJS `npm` binary executable modules to the path.
+* [__pbcopy__](https://github.com/bpinto/oh-my-fish/tree/master/plugins/pbcopy) – OSX's pbcopy and pbpaste for Linux.
 * [__percol__](https://github.com/bpinto/oh-my-fish/tree/master/plugins/percol) – Browse your fish history with [percol](https://github.com/mooz/percol).
 * [__peco__](https://github.com/bpinto/oh-my-fish/tree/master/plugins/peco) – Browse your fish history with [peco](https://github.com/peco/peco).
 * [__osx__](https://github.com/bpinto/oh-my-fish/tree/master/plugins/osx) - Integration with Finder and iTunes.
diff --git a/plugins/pbcopy/README.md b/plugins/pbcopy/README.md
new file mode 100644
index 0000000..951bec3
--- /dev/null
+++ b/plugins/pbcopy/README.md
@@ -0,0 +1,38 @@
+# pbcopy
+> OSX's pbcopy and pbpaste for Linux
+
+pbcopy paste data from the clipboard to STDOUT.
+pbpaste paste data from the clipboard.
+
+## Usage
+
+Copy a list of files in your home directory to the OS X clipboard:
+```fish
+$ ls ~ | pbcopy
+```
+
+Copy the contents of a file to the clipboard:
+```fish
+$ pbcopy < cookies.txt
+```
+
+Copy part of a file to the clipboard
+```fish
+$ grep 'ip address' serverlist.txt | pbcopy
+```
+
+Paste from your clipboard to stdout
+echo `pbpaste`
+```fish
+$ pbpaste
+```
+
+Paste from your clipboard to a file
+```fish
+$ pbpaste > clipboard.txt
+```
+
+Paste from your clipboard to a file in a remote host
+```fish
+$ pbpaste | ssh username@host 'cat > ~/myclipboard.txt'
+```
\ No newline at end of file
diff --git a/plugins/pbcopy/pbcopy.fish b/plugins/pbcopy/pbcopy.fish
new file mode 100644
index 0000000..e485991
--- /dev/null
+++ b/plugins/pbcopy/pbcopy.fish
@@ -0,0 +1,7 @@
+function pbcopy --description "Copy data from STDIN to the clipboard"
+  xsel --clipboard --input
+end
+
+function pbpaste  --description "Paste data from the Clipboard"
+  xsel --clipboard --output
+end
-- 
GitLab