Is it possible to invoke vim from another program to edit a block of text passed from that program and have vim return the edited text to the invoking program without writing it to a file?

I am writing a program in Go, the program's data is stored encrypted but the encryption method is AES not Blowfish or PK. The program can take care of AES encryption and decryption but I don't want the data stored unencrypted in any temporary/intermediary file.

I know vim supports Blowfish and PK encryption but not AES.

I know vim can read from STDIN (using - in place of filename) but don't know of a way for vim to return data (other than by writing it to a file for the other program to read).

I know vim has some client-server modes but these don't seem to have the objective described above. They allow another program to pass in editing commands. I want interactive editing of text from/to a non-filesystem source.

I suspect this is possible but I haven't yet hit upon the right search terms to find any description of how to do this in vi.stackexchange.com in vim help or elsewhere.

  • There is a vipe program which edits pipe streams
    – D. Ben Knoble
    May 27 '21 at 12:39
  • @D.BenKnoble: Thanks, I didn't know about vipe. However if this answer elsewhere is correct, vipe stores the piped data in a temporary file. I want to avoid that happening. May 27 '21 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.