ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 Tatendaz

fold-edits

Claude Code 补丁,将 Edit、Write 和 NotebookEdit diff 折叠为带显示/隐藏按钮的一行,使用适配主题的颜色,并处理超过 10,000 个字符的 diff。

已翻译

关于这个 mod

fold-edits 将每次 Edit 和 Write 调用下方打印的完整 diff 替换为一行摘要和一个打开 diff 的 show diff 按钮;较长 diff 的上下方会显示 hide 按钮。它影响 Edit、Write 和 NotebookEdit 结果(失败的编辑保持不变)以及只包含编辑的群组,例如 scratchpad 编辑;包含读取或 shell 命令的混合群组保持不变。超过 10,000 个字符的 diff 会拆成多个区块,并使用正确的行号。按钮文字颜色根据主题选择(深色主题使用深绿 #116329,浅色主题使用浅绿 #aceebb),默认回退到深绿。仓库包含用于生成 README 主题图片的 Python 脚本和测试命令:`claude plugin test ~/.claude/mods/fold-edits。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add Tatendaz/T-mods
claude plugin install fold-edits
原文 / README

fold-edits

Claude Code prints the full diff under every Edit and Write call. A long session fills the screen with code you did not ask to read.

This mod replaces each diff with one line and a button that opens it:

<picture> <source media="(prefers-color-scheme: dark)" srcset="docs/fold-edits-dark.svg"> <img alt="fold-edits: an edit folded to one line with a green show diff button, then opened with hide buttons above and below the diff" src="docs/fold-edits-light.svg"> </picture>

Click show diff to open the diff. Click hide to fold it again. When the diff is open, a hide button sits at both the top and the bottom, so you do not have to scroll back up on a long diff.

What it changes

  • Edit, Write and NotebookEdit results. A failed edit is left as Claude Code draws it.
  • Groups that hold only edits, such as Claude Code's "Made 1 scratchpad edit" line. A group that mixes edits with reads or shell commands is left alone.

A diff longer than 10,000 characters, the limit for one code block, is split into several blocks. Line numbers stay correct across the split.

Button color

A plugin cannot set a button's text color, so the mod picks the green behind the text from your theme:

  • Dark themes get #116329, with light text on top.
  • Light themes get #aceebb, with dark text on top.

If the mod cannot read the theme setting, it uses the dark green.

Images

docs/make_svgs.py draws the two README images, one per theme. GitHub shows the one that matches the reader's theme. Run it again after a change to how the mod looks.

Tests

claude plugin test ~/.claude/mods/fold-edits

The tests cover the summary line, opening and closing the diff, both button colors, diff splitting, edit-only groups, and leaving other tools alone.

更多类似作品