Tatendaz/T-mods/tree/main/fold-edits
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.
