Normal Mode

Batch Editing Files with Vim

Waaay back in 2018, Julia Evans wrote this terrific post about how to edit a BUNCH of files by writing a little ed script. You should absolutely go read the whole post where she explains how to use ed to perform a sequence of edits she’d normally do in Vim. I just want to add the note that the code she ends up with is also perfectly valid Vimscript. So you can run the EXACT same script in Vim!

Not a Recursive Macro

When I first started my plan to concoct a classically recursive macro, I got as far as writing a complete, functioning implementation before I stopped to think and realised that what I’d been working on wasn’t actually a recursive algorithm at all but was in fact iterative. 🤦 But even though the macro below doesn’t actually fulfil the brief, I’m still kind of proud of the method I came up with for incrementing and testing the loop index, so I thought I’d post it here for posterity.

Extract Variable Mini Refactor with CTRL-A

Insert mode’s CTRL-A was one of those Vim features that I knew about for ages but didn’t get the point of until someone showed me this ONE WEIRD TRICK1 that uses it to ASTONISHING effect2. I added it to my toolkit, and after a while found myself using CTRL-A in loads of other scenarios too! The :help for CTRL-A in insert mode is… shall we say… concise: CTRL-A Insert previously inserted text.


There used to be a nifty Mac utility called QuickCursor. It set up a global hotkey you could use whenever you were editing text in any app. When invoked, it would open up a copy of your chosen text editor1 passing the text into it. You could then edit away using the FULL POWER of your editing setup, and when you saved the file the text would be copied back into the app where it came from.

Welcome to Normal Mode

Hi! Welcome to Normal Mode. This site is my love letter to the best text editor, and a compendium of some of the wonderful things you can do with it. I’ve got OODLES of CONTENT planned, so fire up your RSS reader, follow on Mastodon or Twitter, and get EXCITED about Vim WOOOOO.