Preview mode
Author: ricochet1kCreated Apr 25, 2019Updated Feb 20, 2026
LabelsC-enhancementA-preview
I would love a better way to preview changes, something more than just not using the -i flag.
Use case: sd 'find' 'replace' $(fd -e rs)
This just dumps all of my files un-colored to the terminal which isn't helpful.
I propose there be a -p flag for preview, which only shows lines that match along with file and some short amount of context. Like what grep -C3 prints out. For each of the lines that match, show the matched part in red, and the replacement right next to it in green, inline. Or maybe use strikethrough and bold, although those are less widely supported.
Bonus points if the styles are configurable somehow. Even more bonus points for coloring the output like bat
Source: chmln/sd