Step 1: Make sure you have pbpaste and pbcopy ready and that tmux is configured to behave itself: https://evertpot.com/osx-tmux-vim-copy-paste-clipboard/
Step 1.b: The config is slightly borked due to new versions, see this issue: tmux/tmux#754
Step 2: In your .pryrc
do this:
def pbcopy(input)
str = input.to_s
IO.popen('pbcopy', 'w') { |f| f << str }
str
end
def pbpaste
`pbpaste`
end
Pry::Commands.block_command 'paste_eval', "Pastes from the clipboard then evals it in the context of Pry" do
_pry_.input = StringIO.new(pbpaste)
end
Step 3. Do this in Pry and enjoy: paste_eval