Skip to content

Instantly share code, notes, and snippets.

@zunda
Last active August 2, 2024 08:08
Show Gist options
  • 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