How to see moved lines in a file comparison with vimdiff / diff

diff()vimvimdiff

Moved lines are frequently annotated as deletes and adds but they can be shown as moved-from and moved-to instead.

Like in this screenshot of Notepad++.

Notepad++ diff'ing moved lines

Best Answer

For its diff view, Vim relies on the output of the diff tool, which consists of line insertions (+) and deletions (-), but no moves. For convenience, Vim is able to highlight changes within a line, but it does not detect moves of (blocks of) lines, unlike Notepad++. You would need to implement this kind of feature yourself (e.g. using the sign column to show the moves).

Related Question