1

Size of one file is 200 Mb, while the size of another file is 20 Mb. I need to press ctrl+c to stop loading the big file, when no vimdiff mode is enabled although I run:

vimdiff <(hexdump -C r328.raw) <(hexdump -C r328_000.raw)

so I am here now but I would like to have colours for differences:

enter image description here

How can you start vimdiff of two files in vertical mode?

6
  • Pressing ^C will abort whatever Vim is doing, such as applying colours. You probably just need to be more patient... Commented Jul 23, 2015 at 9:49
  • @Carpetsmoker I would like to apply them now to the content what is there. The point is not to wait since I could put there too 2TB file. Commented Jul 23, 2015 at 9:58
  • 1
    @Masi try running :diffupdate
    – muru
    Commented Jul 23, 2015 at 10:10
  • 1
    The "content that is there" is 2TB of data. Vim always reads the entire file into memory, so editing a 2TB file will not work in Vim unless you have a lot of swap space. Vim also doesn't diff by itself, it uses the extenal diff tool and parses the output of that. If you want to have it behave different, you'll have to write your own diffexpr function (:help diff-diffexpr)... Commented Jul 23, 2015 at 10:14
  • @Carpetsmoker My need is max 2 Gb now. Commented Jul 23, 2015 at 10:15

3 Answers 3

6

You could use use the --length option of hexdump to only load 20Mb of the large file so you don't have to cancel what Vim is doing as @Carpetsmoker mentioned. Ex:

vimdiff <(hexdump -C --length=20000000 big) <(hexdump -C small)
1

By default vim -d (at least my version, 7.4) will open files in vertical mode, i.e. side by side. (This is equivalent to using -O option.)

To open files in "stacked" mode, i.e. one below another, add -o option.

0

To extend on accepted answer: you can just read exactly same number of bytes from both files:

vimdiff <(hexdump -C -n $(stat -c %s small) big) <(hexdump -C small)

On Mac OSX, the command will instead be:

vimdiff <(hexdump -C -n $(stat -f %z small) big) <(hexdump -C small)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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