April 15, 2020 at 3:16 PM by Dr. Drang
Here’s a simpler Drafts action than yesterday’s, but one that also mimics a BBEdit command. It’s , which is bound to ⌘⌥V. It does exactly what its name implies: pastes what’s on the clipboard into the current draft and then immediately selects it.
When would you need this? Typically it’s when the text you’re pasting needs to be reformatted in the document you’re pasting it into. For example, when I paste the source code of a script into my blog posts, I usually add line numbers and indent it right after pasting so the Markdown processor converts it to code instead of prose. It saves what can be a time-consuming and error-prone step if I don’t have to scroll around to select all the text I just pasted in.
As with regular pasting, if there’s an active selection, the clipboard replaces it. If there’s no active selection, the clipboard is inserted at the cursor.1
I wrote a somewhat different version of this script a while ago. It worked fine, but after writing the Prefix/Suffix script and rewriting my line numbering script, I thought it would be best if I rewrote this one, too, to make the variable naming more consistent across my scripts. Cleaning up old scripts is one of those rainy day projects that the current situation has given me time to do.