Vim Carnival Entry: "The Motion that Changed Everything."

Tue 02 June 2026

Fedifriend and fellow vim-addict Hyde is hosting what's called a "Vim Carnival", where someone sets a topic and encourages others to blog about the subject at hand concerning vim.

With permission, I'm going to slightly modify the subject to apply to nvi, but the option I will be explain also works in vim.

First, a little background (read: ADHD oversplaining go BRRRR!)...

Background

I've been using vi and vi-inspired text editors for over a quarter century. I think I probably first tried it on a VT320, couldn't figure out how to quit, and never wanted to try it again 😄. Then, either in 1998, when taking a class on Unix Shell programming, or in 2000 (when I switched my personal laptop over to Linux full-time for the first time) I decided to sit down and properly learn vi/vim, and managed to learn the basics well enough to get around, though not particularly gracefully.

I distinctly remember being asked to create a document when I started working as a Unix Security Analyst in 2002. Being extremely wary of Microsoft products, I created the document in vi on an HP-UX test server I had access to. I then scped the hand-created HTML document from the server onto my Windows 2000 workstation, opened it up in Word, and saved it as a .doc for others' use. (No, we didn't have any way of creating .PDFs at that time).

vi/vim was my daily-driver and preferred word-massager from the dawn of the 21st century until now, although I confess with measurable remorse that I did use Microsoft Word a good bit in college from 2013-2017, but I've recovered now. 😅

Slow Progress

The thing with vim is, its feature list is EXPANSIVE. That's not vim's fault. I wouldn't ever say it's too much, but it's just a lot. It's also not as easily discoverable as a GUI editor is. You have to do a fair bit of RTFM, and that's definitely fair. So, my vim skills largely languished and didn't really progress beyond the basics for many, many years.

My skills have grown a fair bit in the last few years thanks to kind friends online (like Hyde) who share tips and tricks, and spur on my desire to learn more, to tweak, to master a skill I find both highly valuable in terms of efficiency, and highly satisfying in terms of enjoyment. With a good text editor (particularly one of the vi-derived ones, in my humble opinion), you don't feel like you're trying to select text or move text. It feels like your mind has telekinetic control over the text on-screen. It's really an amazing feeling.

Progress Through Regress

I'm not certain how I came upon this decision or why, but about a week ago, I decided to stop using neovim (an excellent vim fork with a built-in Lua JIT and greater options for macros and customization), and rewind the clock to the mid-1970s by switching my editor to the old-timey vi.

Or actually, not quite. More like mid-1990s. You see, while the original 1976 vi's source code is out there and is FOSS, for the longest time, it was encumbered by a very restrictive license due to using some small portions of its code coming from the original AT&T Unix. So, even though it was developed at the UC Berkeley CSRG, it couldn't be distributed with the freely-available BSDs. Instead Keith Bostic developed nvi in 1994 to be a very close clone of the original, and that is the version that has been either pre-installed on, or available for nearly every Linux Distro and BSD variant since the 1990s.

So, I had a certain desire to pare things down and enjoy minimalism a bit more. I recall reading how Rob Pike decided not to add syntax highlighting to Acme because it's distracting. I can't say for sure if syntax highlighting is distracting or not, given that I've enjoyed it for years, going all the way back to Think Pascal for the Macintosh in the very early 1990s, which placed reserved words in boldface. I do think highlighting can be helpful for spotting obvious errors in code (as long as the syntax highlighting is accurate; sometimes it isn't), but I have been enjoying the exercise of reading code (shell scripts, in my case) more carefully without it, and I think my eye for code is keener for it.

I've found the process of "regressing" back to nvi ironically very liberating, because while it's more limited than vim, it's far easier to fully comprehend (understand and completely wrap your mind around) its feature set vs. something more sophisticated like vim. That makes the experience of learning it a lot less stressful/intimidating. But for its simplicity, "vanilla" vi actually has more features than I ever realized (including multi-level undo!).

The manual page is fairly long (30 pages when converted to PDF), and relatively terse, but still quite doable, and as you start pecking at it over several days to pick up different options and capabilities, a more complete feature of what it can and can't do begins to develop in your mind.

The Motion that Changed Everything: ~

My most recent discovery in nvi (which I now realized also works in vim) is set tildeop.

The tilde (~) command in vi/vim is a powerful one because it can reverse the case of the text under the cursor, or the text highlighted. Many people have posted their own favorite combination command using the tilde, and the one I used most often was 0v$~, which jumps to the beginning of the line, marks to the end of the line, and toggles the case. This is useful for a variety of reasons, including just ALL CAPSing text when you don't feel like using the dreaded* Caps Lock.

* "Dreaded" for two reasons: one, I swap Caps Lock with Escape on my machines, so it's a little harder to reach, and two, leaving Caps Lock on and going into command mode in vi can have disastrous and unintended consequences. 😆

But while 0v$~ works well in vim, it doesn't work in classic vi, because there's no selection mode (although you can use marks to select a range of lines for certain operations, like :'a,'bs/foo/bar/). What I found is if you use set tildeop, the tilde no longer functions as a single-element toggle (in this case, always toggling the case of a single character, because that's all you can really "select" in classic vi), but a toggle combined with a movement key!

So, while just toggling the case of a single character goes from ~ to the slightly more cumbersome ~l (and I will admit to being annoyed at this at times 🙃), toggling the case of a whole word or line is a simple ~w or ~$.

What's funny is that I just found out that even if you don't have tildeop set, you can still do something simple like 0999~, which will toggle the case of the entire line, as long as it isn't longer than 999 characters. (RTFM folks! 😂)
But I still like being able to combine the tilde with movement characters, so it's definitely staying. ;)
I've also discovered that with tildeop set, a quick ~~ will toggle the case of the entire line, so that's even faster! :D

Category: Tech Tagged: ADHD BSD Collaborations Computing FOSS (Free and Open Source Software) Linux Non-religious post Productivity Retrocomputing UNIX

Page 1 of 1