A similar tool made for the dvtm pager: https://github.com/martanne/dvtm/raw/master/dvtm-editor.c
It saves stdin to a file and open an editor on it, then if the file has changed since its creation, it print all the content of the file to stdout. It is used to copy a fragment of a file: select the fragment and save it with :\<,\>w