I want to edit text files with vim, I would love

vim file.txt

To work like normal, and open file.txt in vim, like normal, and allow me to edit it seemingly like normal.

The only difference is, all writes :w or anything, don't re-write file.txt, instead they write to some patch file that shows the differences between the original file and the edited one I am writing.

So after I have finished editing, i should have file.txt and file.txt.diff, and file.txt is identical to how it was before I started editing and file.txt.diff, if patched onto file.txt, would make file.txt look like it did after my edits.

The next time I run vim file.txt it would load the file with the patch, and I can continue editing from how it last "was".

  • Are you looking for version control? git simulates this with it’s index.
    – D. Ben Knoble
    Dec 25 '18 at 14:15
  • @D.BenKnoble I have a bunch of source code that I don't want to put on github, but I do want people to be able to see what changes I make to the original code Dec 25 '18 at 19:42
  • One can use git without using GitHub; local copies, your own server, &c. GitHub is just a convenient cloud solution (but does allow private repos). It does precisely what you ask.
    – D. Ben Knoble
    Dec 25 '18 at 20:37
  • @D.BenKnoble I want the changes I make to the code to be publicly visible Dec 25 '18 at 20:38
  • Either I would write a script, that handle this stuff outside Vim. Or much better: I would use git locally and create diffs between versions to release. Anyway this is nothing that should be handled in Vim IMHO.
    – Ralf
    Dec 25 '18 at 22:12

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.