Copilot in the shell with Ctrl+X, Ctrl+E

Add me on LinkedIn! You can cite this post as a reason if you're shy.

A tiny convenience I recently discovered: Hitting Ctrl+X, Ctrl+E in a terminal window will put your command into your text editor so you can massage your commands.

I often have long ansible or kubectl commands I want to either run, or insert slashes into to put into my company’s internal documentation. I do it here with vi (badly!), but there’s nothing stopping you from customizing things so you can do it with whatever floats your boat by setting the $EDITOR flag in your .bashrc-like.

Originally my post ended there! Later I realized that, since I had Github Copilot enabled in Neovim already, setting $EDITOR was also a way to get Copilot in the terminal for free while also being much more pleasant to write. Here’s me using it to optimize some GIFs so I don’t end up paying an arm and a leg in bandwidth costs again when my fzf post goes viral:

This is huge, because shell has an enormous library of training data that I’ve found Copilot does unusually well with. Sadly that loop will never work again now that I’ve used a Neovim greater-than-16-color pallette in that directory!


Home

Friends of the stable sort: alex (sbsbsb.sbs)

Death comes last to the party! Meanwhile I'm biding my time! So you can't take your own life - that's cutting in line!