Is there a way to save the changes I made to my vim buffer as a patch file for the original file, without saving it as a separate file and using diff?
How to save the changes to the vim buffer as a patch file
diff()vim
diff()vim
Is there a way to save the changes I made to my vim buffer as a patch file for the original file, without saving it as a separate file and using diff?
Best Answer
It's possible to do this without a plugin using the
w
command, so the buffer contents can be used in a shell command:(
%
is substituted with the path of the file being edited,-
reads the buffer from stdin)