Currently, I am editing files on vim by setting
patchmode=.orig and then, having two files:
file.txt.orig<- backup without changes
file.txt<- update file
However, I would like to generate a diff without having to rename the
.orig file, so
patch understands it is just
file.txt which has been updated.
Ideally I would really enjoy a workflow I could run
diff -u file.txt which would automatically compare
file.txt and output a
--- file.txt 2021-05-03 17:47:12.685416342 +0200 +++ file.txt 2021-05-03 17:47:30.538750593 +0200 @@ -1 +1,2 @@ foo bar +bar baz
diff -u file.txt.orig file.txt
--- file.txt.orig 2021-05-03 17:47:12.685416342 +0200 +++ file.txt 2021-05-03 17:47:30.538750593 +0200 @@ -1 +1,2 @@ foo bar +bar baz
The above does require me to manually edit the
.diff file every time.
.orig files automatically, would be possible at all, I would love to integrate vim patchmode with
diff and have a valid patch without extra effort.
Perhaps there's an even better approach to this? Any suggestions would be appreciated. Both
git diff would work for my case.