I'm still poking at #nvi and #vi, and learning interesting little details every day.

Today I learned about the `tildeop` setting, which modifies the tilde command to take an associated motion.

As a result, I no longer miss gU and gu from vim-land. :)

#SimpleTools
#SimplePleasures

@RussSharek
Do you ever feel like line noise invocations like
/b^M0dd2pj^[0"ay$j@a
are literally fantasy wizardry. Imagine Understanding this (Write new line under: search for the next letter b. Kill that line, then paste it twice: move down a line. Now stop editing, and yank this line into my spellbook as 'a'. Move down a line and cast a.)

@screwlisp

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.

@RussSharek cc my vi history guru @dougmerritt
@screwlisp @RussSharek
This is a really fun idea. There are a lot of ways you could expand on it if you feel like it.

@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?

Tim Chase (@[email protected])

@[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)

BSD.cafe Mastodon Portal

@JoshGrams

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&/

@RussSharek

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)

@RussSharek

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

😆

CLI Tricks: Spongebob Sarcasm in awk | Tim's blog

@gumnos

I keep learning a lot from these examples.

Thank you for chiming in!