In Vimdiff, I know I can use “do” or “dp” to move changes from one file to the other…but these are for individual changes. If I have to undo all changes inside a specific scope/selection (say undo all changes to a particular function, but leave the rest untouched), is there a way to do it in one go ?
Share
You can use a visual selection and the ex command
:diffget/:diffputSo, for example to get the changes for just the current insides of a code block ( { … } )
To put the changes for the two enclosing levels including the lines with the brackets:
Note that since these are ex commands the motions are linewise. Of course, you could use any range, so you can repeat the visual range, or use markers
etc. Use your imagination, this is vim 🙂