I am interested in using vim to edit a "secure" file, one that is stored encrypted elsewhere (say, somewhere in the cloud), and should not be written as plaintext to the local disk. So the sequence of events might be (with a separate wrapper script or something for non-vim steps 1, 2, and 5):
- Retrieve encrypted file from the cloud
- Decrypt the file, and launch vim while passing the plaintext to vim for editing (perhaps over a new file descriptor?)
- Edit with vim interactively
- When the file is written using
:w, write the result (again, through a file descriptor?)
- Encrypt the new plaintext and store back in the cloud
Now, I understand that the usual way to do this sort of thing is to decrypt, write a temporary file, edit the temporary file in vim, read the temporary file, encrypt, wipe/delete the temp file. What I'm looking for is a way to avoid using a temporary file at all. (Also, everything in The simplest way to start Vim in private mode would be set.)
Another way to approach this might be to use something like
netrw, which I'm not terribly familiar with.
For the purposes of this question, I'm not concerned about the OS swap data (but if there's a vim way to mark its internal data buffers as non-swappable, that would be interesting).
Is there a way to do the above, or better yet, has somebody else already solved this?