Sublime Forum

Diff Document/Selection with Clipboard?

#1

I use this feature a lot in TextMate to quickly check what’s changed in a file, by selecting text from somewhere (View Source, or something like a web-based editor in Shopify or Big Cartel), and hitting ⌃⇧⌘D with the file to compare open in the editor.

The command in TextMate looks like this:

# set defaultCStringEncoding to UTF-8 if diff --strip-trailing-cr --label "${TM_FILENAME:-untitled}" --label "(clipboard)" -u - <(__CF_USER_TEXT_ENCODING=$UID:0x8000100:0x8000100 pbpaste); then echo "There are no differences." else exit_create_new_document fi

Would that be fairly easy to reproduce in ST2? I could dive in, but thought I’d run it past the Python gurus before clumsily attempting to code it myself. (I’m rusty w/ Python!)

0 Likes