I’m trying to run a diff between the current buffer and its savefile. Because I want to do some processing on the diff output, I need it in a variable, not a new buffer. I know that one way to do this is with
w !diff % - > tmpfile
let myvar = system( cat tmpfile )
Is there any more elegant way?
Assuming you are able to write the buffer, you could do something like
to e.g. compare buffer.txt to buffer.txt~ and put the result in register
aOtherwise, try
In my preliminary test, this appears not to work on Win32 GVIM, though. You might have to go through a temporary file to get this working
I realize this all looks close to what you had tried. Hope it helps anyway, perhaps confirming your thoughts