Vimdiff

From wikinotes
(Redirected from Vim diff)

Key Bindings

]c               - advance to the next block with differences
[c               - reverse search for the previous block with differences

do (diff obtain) - bring changes from the other file to the current file
dp (diff put)    - send changes from the current file to the other file

Tricks/Scripts

# compare several files referring to the same part-filename.
# ex:   a_old_filename.rb  -> a_new_filename.rb
#       b_old_filename_foo.rb -> b_new_filename_foo.rb
#       ...
for f in `git diff --name-status master...HEAD | awk -F' ' '{ print $2 }' | grep old_filename`; do echo "vimdiff <(git show master:$f) $(echo $f | sed 's/old_filename/new_filename/g')"; done