Splitting windows in vim

I am working on a script that has become quite confusing. I suspect there are several sections that have almost identical code. Can I (and how can I) open a file in vim with two (or more) windows in the buffer and split the contents of the windows in one file? vimdiff seems to work on only two files. If I make a copy of the file and try vimdiff two versions, the origin of diff will remain blocked at the beginning of the file. Although I can disable the window lock and move the windows to the parts of the file that I want to compare, the differences are not displayed. Any clues or hints? I could cut and paste sections that I want to compare with different files, and then apply vimdiff, but then I risk getting lost from that section from where I am trying to fix separate files together, and I'm sure there should be more simple , easier.

+5
source share
2 answers

What I usually do is different than copy

:%w %.alt
:vert diffsplit %.alt

And then happiliy rebuild the 'alt' version so that the pseudo-matching bits are aligned.


Note that (presumably) git contains spiffy merge / diff cow-powers, which should be able to detect changes to file attachments of file attachments.

, , git fugitive vim , . : , , , , (, script, !)

+2

, , linediff.vim.

(, ) vimdiff . , diff .

- , script, , , . , - , - , , linediff.

+1

All Articles