Skip to content

Instantly share code, notes, and snippets.

@zunda
Last active May 19, 2021 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zunda/0bd332688300339c3edd to your computer and use it in GitHub Desktop.
Save zunda/0bd332688300339c3edd to your computer and use it in GitHub Desktop.
A scratch pad to be run from a lunch short cut within a terminal on an X11 desktop. Grabs selected text and pastes the completed text onto the clipboard.
#!/bin/sh
set -e
path=$(mktemp -p /tmp scratch.$(date +%Y%m%d-%H%M%S).XXXX.txt)
xsel -o -p > $path
/usr/bin/vim -c 'set enc=utf8 fenc=utf8' $path
cat $path | xsel -i -b
cat $path | xsel -i -p
sleep 0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment