2018年5月30日 星期三

vimdiff 展開 收起 diff sections



https://stackoverflow.com/questions/5288875/how-to-expand-collapse-a-diff-sections-in-vimdiff



Keyboard Shortcuts:

d o Get changes from other window into the current window.

d p Put the changes from current window into the other window.

] c Jump to the next change.

[ c Jump to the previous change.


CTRL+W, w - Switch to the other split window
(CTRL+W, CTRL+W does the same thing, in case you let go of the CTRL key a bit later)



:diffupdate :diffu -> recalculate the diff, useful when after making several changes vim's isn't showing minimal changes anymore. Note that it only works if the files have been modified inside vimdiff. Otherwise, use:

    :e to reload the files if they have been modified outside of vimdiff.


:set noscrollbind -> temporarily disable simultaneous scrolling on both buffers, reenable by
:set scrollbind and scrolling.



Most of what you asked for is folding: vim user manual's chapter on folding. Outside of diffs I sometime use:

    zo -> open fold. 或是按方向右鍵
    zc -> close fold.

But you'll probably be better served by:

    zr -> reducing folding level.
    zm -> one more folding level, please.

or even:

    zR -> Reduce completely the folding, I said!.
    zM -> fold Most!.