A CLI icon with the word 'vipe' to the right. There's some blurry text in the background that looks like a command.

Vim + pipe?

Every now and then you come across a little tool that makes you go "/Oooh, that's neat. Wish I'd known about that before./" vipe is one of those. Granted, you might not need it every day, but sometimes it's just the right tool for the job.

The tl;dr: is that it's a way for you to pipe something into your $EDITOR and then pipe it on into another command when you're done editing it. That's right! There's no need to save it to an intermediate file and clutter your workspace, nor do you have to do everything via sed (though that can be a fun experience).

How did this come about? Well, we wanted to migrate a config map from one OpenShift project to another at work. Rather than saving the config to an intermediate file, we wanted to see if we could pipe it through an editor and back into oc apply with the required changes. And sure enough, we could:

# kubectl should work just the same as oc
oc get configmap <config-map> -o yaml \
| vipe | oc apply -f -

The first command gets the config map from the server in yaml format, the second (vipe!) pipes it into your $EDITOR, letting you make any necessary changes, and the last one takes your updated config map, applying it to the server for you.

vipe is available as part of the moreutils package, available via various package managers including Apt, Nix, and Homebrew. There's a couple more interesting packages in there too, so it's worth checking it out just for that!



Thomas Heartman is a developer, writer, speaker, and one of those odd people who enjoy lifting heavy things and putting them back down again. Preferably with others. Doing his best to gain and share as much knowledge as possible.