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

Posted by Hristos T. on 2017-11-23, under the category Emacs
Tags: fish, ansible

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"
end

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!