I am DELIGHTED to announce the release of version 1.0.0 of Rainbow Trails. It contains a small but meaningful number of bug fixes and filed off edge cases, and includes a completely reworked and highly configurable new timing system allowing precise control over the speed the rainbows traverse the buffer. It also features some improvements to highlighting.
If you already use Rainbow Trails, it’s a substantial improvement. If you don’t already use Rainbow Trails, now is a great time to start!
I wrote a new plugin over Easter. It is called Rainbow Trails1 and it adds a touch of MAGIC to your motions.
If your life could do with a spot of COLOUR, You should go install it now!
I’m not good at naming things. Did I mention this very site was delayed for literal YEARS till I managed to come up with a good domain name?2 ↩︎
Of course, then two came along at once.
The Question After seeing the macro Game of Life, Benoit de Chezelles asked on Mastodon:
I replied:
But just because something isn’t practical, doesn’t mean it’s not possible, and so I decided to write this post to explain how you can write a macro that acts differently depending on whether anf,motion succeeds or fails.
The Challenge Benoit politely declined to give me a real-life scenario where he needed this, so I whipped up the following CONTRIVED editing task.
I’ve never done Advent of Code before, and I wasn’t planning to do it this year1, but for some reason I decided to try my hand at solving the 2023 event’s Day 1’s challenges in Vim, using only its editing commands. (So ex commands are allowed, but Vimscript’s more programmerly constructs — functions, loops, conditionals, etc. — aren’t.)
It was fun!
So much fun, in fact, that I ended up carrying on and completing a bunch more of the challenges.
I have devised an entirely new method of sorting numbers. Quicker1 than quicksort, more EFFERVESCENT than bubblesort, I present to you:
Vim Macro Sort Vim Macro Sort uses NO Vimscript, NO chicanery with control characters, and it NEVER leaves normal mode. It’s just a plain old ASCII text file with a bunch of editing commands in it.
Try It Out! Start using this new sort macro TODAY!
Download macrosort.txt, open with the command: vim --clean macrosort.
When I found out that Bram had died I posted a short thread on Mastodon, but I haven’t written anything here yet because I haven’t quite been able to work out why it hit me as hard as it did and what I wanted to say about it.
Two months on, I still haven’t really figured it out, so I’ll just say that, by all accounts, Bram was an exceptionally generous person, and note that in the handful of extremely limited interactions I had with him I always came away feeling positive, which hasn’t always been my experience with other open source projects.
Vim’s insert mode completion has a very nice feature where you can start typing a natural language word and then press Ctrl-XCtrl-K to complete it.
By default, it pulls the words used for the completions from the file specified with your 'dictionary' option, but this requires you to have such a file, which is not always1 the case for the computers I do my Vimmin’ on.
But there is a backup!
Tim Chase posted a clever little :substitute command on Twitter:
Had some regex with lots of repeated \d in them like \d\d\d\d
Converted them all to \d{n} notation in vim using
:%s!\%(\\d\)\{2,}!\='\d{'.(strlen(submatch(0))/2).'}'!g
Just in case it's useful for anybody else.
— Tim Chase (@gumnos) May 18, 2023 As always, my instinct was immediately to see if you can do it as a macro1.
You can. Here’s how:
qqqqq/\v(\\d)+\zs\\dEnterc2l{2}Esc@qq@qqq/\\d{\d}{2}EnterCtrl-All3x@qq@q
(Yes, this is actually two recordings.