Suppose I create a diff of my project before committing, say, using svn. Having one diff for all files in a project is a very good way to see the changes before they are executed. However, sometimes I want to edit these changes without re-opening each file, just edit the diff and reapply it. Therefore, I made such a key card (I have the svn diff setting to use a unified format with enough surrounding lines):
map scde :w! tmpdiff<cr>:!svn revert -R .<cr>:!patch -p0 <tmpdiff<cr>
It works, but only partially; you can edit the added lines, but if you mark the lines as deleted or you want to add another line, you will get some problem, since the indicated ranges of differences do not correspond to the actual text present in the diff. You can update them for simple changes, such as adding a line, however it is tedious and quickly gets complicated if you make more complex changes. Is there a way to edit diff so that the range automatically updates correctly? I found that emacs has some diff mode for this (however, I have not tried it), however I could not find a solution for my needs using vim. Maye, can someone give some suggestions?
source
share