工具与资源github.com
Delta:为 Git、diff、grep 和 blame 输出提供语法高亮的分页器
Delta: A syntax-highlighting pager for Git, diff, grep, and blame output
2020 — 2024,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
Delta 是一个用 Rust 编写的语法高亮分页器,可为 Git、diff、grep 和 blame 的输出提供语法高亮,用背景色代替 +/- 标记增删内容,并高亮行内差异部分。它基于 syntect 库,与 bat 共享同一套主题和配置体系。
为什么经久不衰:它把终端里最常看的 diff 输出变得清晰易读,且持续维护、配置灵活,多年来一直是开发者提升命令行体验的首选工具。
HN 评论精选
介绍 Delta 的核心功能与技术实现,指出它与 bat 共享 syntect 库和配置
Delta 对 git 和 diff 输出中的代码部分应用语法高亮,用背景色(而非 +/-)标示增删内容。它用 Rust 编写,基于 syntect 高亮库——与 bat 使用同一库,因此支持所有相同的配色主题,你已有的 bat 配置(环境变量、自定义主题/语言支持)也会被自动沿用。Delta 还会推断并高亮行间差异的子串(类似 GitHub、GitLab 等差异查看器),并可选地对原始 diff 输出做轻微清理,使其更易读。
Myrmornis查看英文原文
Delta[0] applies syntax highlighting to the code sections of git and diff output, and uses background colors (instead of +/-) to indicate added / removed content. It's written in Rust, and uses the syntect[1] highlighting library. That's the same library that bat[2] uses, so delta supports all the same color themes, and any bat configuration that you already have in place (environment variables, custom themes/language support) is automatically honored by delta. Delta also infers and highlights substrings that differ between lines (similar to Github, Gitlab and other diff viewers) and optionally cleans up the raw diff output slightly to make it more human readable. [0] https://github.com/dandavison/delta [1] https://github.com/trishume/syntect [2] http://github.com/sharkdp/bat/
推荐官方自带的轻量替代品 diff-highlight
这个工具很棒。类似地,我很喜欢 diff-highlight,它对 git diff 做后处理并用颜色高亮差异片段。它非常轻量,而且是 git 官方仓库的一部分;我把它存为独立的 perl 脚本放进 $PATH,然后在 .gitconfig 中引入。
apas查看英文原文
This is neat. In a similar fashion I'm a big fan of diff-highlight, [0] which post-processes the git diff and highlights with color the differing segments. It's super lightweight and part of the official git repo; I've saved it as a standalone #!/bin/perl in my $PATH and then included it in my .gitconfig: [pager] log = /Users/user/.bin/diff-highlight | less show = /Users/user/.bin/diff-highlight | less diff = /Users/user/.bin/diff-highlight | less [0]: https://github.com/git/git/tree/master/contrib/diff-highlight
询问与 git add -p 的兼容性,暗示同类工具在此有缺陷
它能与 `git add -p` 正常配合使用吗?这是 diff-so-fancy 长期存在的问题。
frou_dh查看英文原文
Does it work properly with `git add -p`? That's a longstanding issue of diff-so-fancy: https://github.com/so-fancy/diff-so-fancy/issues/35
指出 Windows 用户需要替换 less.exe 才能正常使用
如果你想在 Windows 上使用,需要换用我打过补丁的 less.exe 版本。
lzybkr查看英文原文
If you to use this on Windows, you'll need to update `less.exe` with my patched version - https://github.com/lzybkr/less/releases/tag/fix_windows_vt
历次讨论
同类还值得读
直接在浏览器中启动 Linux 内核
Boot a linux kernel right inside your browser.
Fabrice Bellard 的 JSLinux 页面,用 JavaScript 在浏览器里启动一个 Linux 内核,并提供一个可交互的终端环境。
工具与资源上首页 5 次 · 2011–2025bellard.orgHacker News 未公开功能与行为清单(2018)
A List of Hacker News's Undocumented Features and Behaviors (2018)
数据科学家 Max Woolf 整理的 Hacker News 未公开功能与行为清单,涵盖投票机制、排名算法、账号惩罚等社区运作细节。
工具与资源上首页 5 次 · 2019–2025github.comMapSCII:在终端中用盲文和 ASCII 渲染地图
MapSCII – Braille and ASCII map renderer for the console
MapSCII 是一个在命令行终端里渲染地图的开源工具,用盲文字符和 ASCII 字符把地理数据画成可交互浏览的字符地图。
工具与资源上首页 5 次 · 2017–2025github.com顶尖大学的免费在线课程
Free Online Courses from Top Universities
Open Culture 整理的一份免费在线课程合集,汇集了全球顶尖大学(如 MIT、斯坦福、耶鲁等)向公众开放的网络课程资源,涵盖音频、视频等多种形式。
工具与资源上首页 5 次 · 2010–2022openculture.com淘气字符串:容易引发用户输入问题的字符串清单
Naughty Strings: A list of strings likely to cause issues as user-input data
一个 GitHub 仓库,收录了大量容易让程序出问题的用户输入字符串,如特殊字符、emoji、SQL 注入片段、系统命令等,供开发者用于测试输入处理逻辑。
工具与资源上首页 4 次 · 2015–2020github.com