Skip to content

Instantly share code, notes, and snippets.

@dln
Created June 19, 2021 09:48
Show Gist options
  • Save dln/ddec790e704a834bd5de134ce6a45e11 to your computer and use it in GitHub Desktop.
Save dln/ddec790e704a834bd5de134ce6a45e11 to your computer and use it in GitHub Desktop.
Copy to clipboard using OSC 52. Works over remote in most terminals.
#!/bin/sh
exec echo -en "\x1b]52;c;$(base64 -w0)\x07"
@dln
Copy link
Author

dln commented Jun 19, 2021

Also works fine as a function in your .zshrc/.bashrc:
function clip { echo -en "\x1b]52;c;$(base64 -w0)\x07" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment