Created: 2022-11-16 Wed Last modified: 2023-07-15 Sat
Vimdiff: Commands¶
Starting diff mode [1]¶
vimdiff file1 file2 [file3 [file4]]
vim -d file1 file2 [file3 [file4]]
If you prefer horizontal splits add the -o argument:
vimdiff -o file1 file2 [file3 [file4]]
Viewing diffs [2]¶
:dif[fupdate][!] |
Update the diff highlighting and folds. |
Jumping to diffs [3]¶
[c |
Jump backwards to the previous start of a change When a count is used, do it that many times |
]c |
Jump forwards to the next start of a change When a count is used, do it that many times |
Diff copying [4]¶
:diffget do |
Modify the current buffer to undo difference with another buffer The "o" stands for "obtain" ("dg" can't be used, it could be the start of "dgg"!) |
:diffput dp |
Modify another buffer to undo difference with the current buffer |
Opening and closing folds [5]¶
zo |
Open one fold under the cursor |
zc |
Close one fold under the cursor |
zm |
Fold more |
zM |
Close all folds |
zr |
Reduce folding |
zR |
Open all folds |
References