Usually, when I want to open a file encrypted by ansible-vault for editing, I just run ansible-vault edit <filename>
- this decrypts the file to a temporary file and opens it for editing.
However, what I want to know is how to achieve this from within vim, e.g. by running a shell command using the :! ...command...
syntax. For instance, I know that I can decrypt the file by open the encrypted file in vim, then running this:
:! ansible-vault edit %
But that opens the file with ansible-vault in a different window, and then you have to press a key to return to vim.
What I want to do is to be able to open this file with vim such that I can edit it alongside other regular files or files that are encrypted with ansible-vault. Currently I'm doing this by opening several tmux panes, but that's kind of a PITA.
:r! asnsible-vault edit ...
. Editing normal files within vi(m) would be:e filename