I suspect you might be on to something...
Not too long ago, I had a really vivid dream about being a wizard and casting these sorts of 'incantations' as spells. Despite years of poking at computers, it took digging into the "old ways" to get my brain thinking like that.
Today's was a far simpler spell: `~$` transforming an entire line to uppercase, which was even faster than passing the line to helpful mystic creatures like tr, sed, or awk.
I'm reminded of the 'unix magic' poster.
That's the one.
@RussSharek Wait, but doesn't tilde *flip* the case of letters? So it doesn't replace gU and gu for anything that's mixed case, which is *most* of my usage for those.
Or am I missing something?
@[email protected] setting tildeop would be more like g~ but you can also pipe ranges of lines to tr(1) or rot13(6)/caesar(6) for things like gU: :'a,'b!tr a-z A-Z gu: :'a,'b!tr a-z A-Z and g?: :'a,'b!rot13 :'a,'b!caesar 13 (though it's more challenging for things like word-wise or sentence-wise transformations)
You're right, it flips them. In my enthusiasm for a new (to me) tool I only focused on a simpler use case which I needed. I often need to capitalize an entire line, and letting ~ accept counts and motions was a win for me.
I see a few helpful friends chimed in with some other answers. I found this method, which could be mapped to keys:
Lowercase
:%s/pattern/\L&/
Uppercase
:%s/pattern/\U&/
setting tildeop would be more like g~ but you can also pipe ranges of lines to tr(1) or rot13(6)/caesar(6) for things like gU:
:'a,'b!tr a-z A-Z
gu:
:'a,'b!tr a-z A-Z
and g?:
:'a,'b!rot13
:'a,'b!caesar 13
(though it's more challenging for things like word-wise or sentence-wise transformations)
And if you need it, you cAn hAvE SpOnGeBoB SaRcAsM TrAnSfOrMaTiOn tOo:
https://blog.thechases.com/posts/cli/cli-tricks-spongebob-sarcasm-in-awk/
:'a,'b ! sarcasm.awk
😆