2

I want to be able to show someone a particular file's undo history in vim, remotely. It's a little complicated, so let me explain one step at a time.

For starters, I can set a custom undofile and rewind to the start of file history:

$ vim -c "rundo <undofile>" -c "earlier 9999d" <text_file>

I've packaged both files (undofile and text_file) into a tar archive and uploaded those to a web server. Now, I can have someone load the files into vim with:

$ wget -q -O - <tar_archive_url> | tar xf - && vim -c "rundo <undofile>" <text_file>

But this isn't quite what I want — it actually extracts the files to the user's working directory, so now they have to rm them when they're done.

What I'd like is a way to read both the text file and the undofile directly from the command line (via STDIN, process substitution, or some other magic) to achieve the same effect as the command above without littering the user's working directory.

I understand that vim can read a file from STDIN:

wget -q -O - <tar_archive_url> | tar -x <text_file> -f - -O | vim -

but assigning the undofile (with rundo) is an internal vim command, not a shell command. Is there any way to get vim to rundo from STDIN / process substitution / etc rather than a literal file?

0

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.