Using GUI Emacs as an editor for ansible-vault with fish-shell


If you didn't know, ansible-vault is a nifty tool that lets you encrypt things for use with Ansible. For some reason that I've not yet discovered, ansible-vault doesn't care if you've set EDITOR /usr/bin/emacs in your fish.config. To work around this, I use the following alias function:

function ansible-vault
	bash -c "EDITOR=/usr/bin/emacs \$(which ansible-vault) $argv"

With this I can use ansible-vault and it works like I expect it to (that is, it uses the editor I've defined as $EDITOR.) Happy encrypting!

This page was last modified on: 2020-07-26