惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
C
Check Point Blog
D
Docker
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
量子位
有赞技术团队
有赞技术团队
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
M
MIT News - Artificial intelligence
B
Blog
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
月光博客
月光博客

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
Using Diffs in Vim
2021-10-24 · via jdhao's digital space

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 algorithm

So to use histogram diff, add the following setting:

set diffopt+=algorithm:histogram

References#