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?

  • Pressing ^C will abort whatever Vim is doing, such as applying colours. You probably just need to be more patient... – Martin Tournoij Jul 23 '15 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. – Léo Léopold Hertz 준영 Jul 23 '15 at 9:58
  • 1
    @Masi try running :diffupdate – muru Jul 23 '15 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)... – Martin Tournoij Jul 23 '15 at 10:14
  • @Carpetsmoker My need is max 2 Gb now. – Léo Léopold Hertz 준영 Jul 23 '15 at 10:15
5

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)
| improve this answer | |
0

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.

| improve this answer | |
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)
| improve this answer | |

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.