Last active
June 21, 2018 14:08
-
-
Save raven-rock/483422cab6cc453f43ae07b385fa86a3 to your computer and use it in GitHub Desktop.
Ruby integration with xclip. Good for monkeypatching .pryrc. This is great for Windows clipboard integration using Putty and VcXsrv.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pbpaste | |
IO.popen(["xclip", "-o"]).read | |
end | |
alias paste pbpaste | |
class Object | |
def pbcopy | |
Thread.new do | |
open("|xclip -i", "w") do |p| | |
p.write(self.to_s) | |
end | |
end | |
self | |
end | |
alias xclip pbcopy | |
alias copy pbcopy | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment