展示 HN:difi – 一个带有 Neovim 集成的 Git diff TUI (用 Go 编写)
Show HN: difi – A Git diff TUI with Neovim integration (written in Go)

原始链接: https://github.com/oug-t/difi

## Difi:更快的 Git Diff 审查工具 Difi 是一款快速、键盘驱动的工具,用于在推送更改*之前*审查 Git diff。它使用 Go 语言构建,无需索引即可实现即时加载,并以清晰、结构化的文件树形式呈现更改,方便解析。 主要功能包括编辑器感知——直接跳转到 Neovim/Vim 中的行进行快速修复——以及使用 `hjkl` 进行导航。用户可以轻松地在文件树和 diff 视图之间切换,直接编辑文件,并使用简单命令退出。 对于 Neovim 用户,`difi.nvim` 提供了增强体验,具有自动打开文件、可视化 diff(如 GitHub PR)以及交互式审查功能,例如直接在 diff 中恢复或丢弃行。 Difi 可以通过 Brew、Go 或直接下载安装。欢迎贡献,特别是关于 `diff.nvim` 渲染和 Windows 支持方面的贡献。

## difi:一款新的 Git Diff 工具 一款名为 **difi** 的新型终端 Git diff 工具,使用 Go 编写,已在 Hacker News 上分享。其创建者 oug-t 构建它,旨在改进标准 `git diff` 输出,以提升代码审查体验,使其更快、更愉快。 Difi 具有 TUI(文本用户界面)并与 Neovim 集成。开发者特别希望复制 GitHub 在单个文件中高亮显示添加和删除内容的功能,而不是像现有的 Neovim 工具(diffview、code diff)那样使用并排比较。 早期反馈建议使用黑白终端主题进行预览,并增加字体大小以提高可读性。另一位评论员指出 `tig` 具有类似的功能,它提供连续的 diff 查看和内联块还原的 TUI。 你可以在 GitHub 上找到该项目:[https://github.com/oug-t/difi](https://github.com/oug-t/difi) 和 Neovim 插件:[https://github.com/oug-t/difi.nvim](https://github.com/oug-t/difi.nvim)。
相关文章

原文

Review and refine Git diffs before you push

difi

git diff shows changes. difi helps you review them.

  • ⚡️ Instant — Built in Go. Launches immediately with no daemon or indexing.
  • 🎨 Structured — A clean file tree and focused diffs for fast mental parsing.
  • 🧠 Editor-Aware — Jump straight to the exact line in nvim/vim to fix issues.
  • ⌨️ Keyboard-First — Navigate everything with h j k l. No mouse required.

(back to top)

brew tap oug-t/difi
brew install difi
go install github.com/oug-t/difi/cmd/difi@latest
  • Download the binary from Releases and add it to your $PATH.

(back to top)

  • Run difi in any Git repository.
  • By default, it compares your current branch against main.

(back to top)

Key Action
Tab Toggle focus between File Tree and Diff View
j / k Move cursor down / up
h / l Focus Left (Tree) / Focus Right (Diff)
e / Enter Edit file (opens editor at selected line)
? Toggle help drawer
q Quit

(back to top)

Get the ultimate review experience with difi.nvim.

  • Auto-Open: Instantly jumps to the file and line when you press e in the CLI.
  • Visual Diff: Renders diffs inline with familiar green/red highlights—just like reviewing a PR on GitHub.
  • Interactive Review: Restore a "deleted" line by simply removing the - marker. Discard an added line by deleting it entirely.
  • Context Aware: Automatically syncs with your difi session target.

Get difi.nvim

git clone https://github.com/oug-t/difi
cd difi
go run cmd/difi/main.go

Contributions are especially welcome in:

  • diff.nvim rendering edge cases
  • UI polish and accessibility
  • Windows support

(back to top)

Star History Chart

(back to top)


Made with ❤️ by oug-t

联系我们 contact @ memedata.com