



























Diff can be used to compare two versions of the same file to find the changes.
If you use vim, you can use vimdiff to compare files:
Actually vimdiff is just a wrapper around vim executable, you can do the same thing with vim using option -d:
So neovim just removed this bloat. To compare two files using neovim, run:
Previously, Vim has been using external diff tool for file diffs, since patch 8.1.0360,
it beganto use libxdiff, which is much faster and has more features.
According to discussion here, libxdiff is also used as a basis by Git as its internal diff library,
that is when you use git diff inside a git repository.
Since this commit, the vim patch has been ported to neovim too.
You can activate the internal diff algorithm by update option diffopt:
The default diff algorithm is myers diff. Other supported diff algorithm is:
algorithm:{text} Use the specified diff algorithm with the
internal diff engine. Currently supported
algorithms are:
myers the default algorithm
minimal spend extra time to generate the
smallest possible diff
patience patience diff algorithm
histogram histogram diff algorithmSo to use histogram diff, add the following setting:
set diffopt+=algorithm:histogram此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。