0

I have two files with some similar program functions in. But these functions are not ordered

File 1:       | File 2:
function a    | function c
              |
function b    | function e
              |
function c    | function a

Now I want compare "function a" from file 1 with this from file 2, and so with "function c".

The only thing I can think of is to put the parts to diff in own files. But I don't like this idea (as you can think of).

So how can I select a part of a file on my left pane and one on my right pane and start a diff?

It would be great, if this works for the same file either, to comepare e.g. "function a" and "function b" in file 1.

3
  • 3
    you can use the linediff.vim plugin or my NrrwRgn plugin for such Aug 31 at 7:54
  • @ChristianBrabandt - Looks fine to use for comparing parts of one file with another in itself. :) Is there a posibility for two files too? (Something sounds that I should use Emacs for such things...)
    – Andy A.
    Aug 31 at 8:06
  • With linediff plugin, you select 2 areas in visual mode (regardless of the files/buffers) they are from, and run :LineDiff, which sounds like what you would need.
    – padawin
    Sep 1 at 12:33
0

I have a same problem so I developed and posted spotdiff.vim, which provides commands and custom operators to select a range of lines and text area to compare partially in everywhere within windows. Please try to use and enjoy it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.