Add config option for syntax-highlighted yay -Gp output
Is your feature request related to a problem? Please describe.
When using yay -Gp <package>, yay prints the fetched PKGBUILD to stdout as plain text. This is useful for quickly inspecting a package without cloning it, but repeated PKGBUILD inspection is harder than it needs to be because the output is not syntax-highlighted.
A one-off flag is not very useful here because users can already write:
yay -Gp <package> | bat --language bash --style=plain --paging=neverThe missing piece is a persistent yay configuration option so users can configure their preferred PKGBUILD viewer once and then simply run:
yay -Gp yayand get highlighted output automatically.
Describe the solution you would like
Add a config option for the command used to display PKGBUILD output from yay -Gp, for example:
PkgbuildPager = bat --language bash --style=plain --paging=neveror an equivalent JSON/config key if that better matches the current configuration format.
When the option is unset, yay -Gp should keep the current plain stdout behavior. When set, yay should pipe the generated PKGBUILD output into the configured command, allowing users to use tools such as bat, less, or a wrapper script.
This keeps syntax highlighting opt-in, avoids adding bat as a hard dependency, and preserves the current script-friendly behavior by default.
Describe alternatives you have considered
- Adding a command-line flag such as
--highlight: less useful because it is not much better than manually piping tobateach time. - Automatically using
batwhen installed: less predictable and changes behavior depending on the machine. - Changing
--color: confusing because yay already uses--color=always|auto|neverfor yay/pacman UI coloring, not syntax highlighting file contents.
Additional context
Related but not exactly the same as #2542, which discusses syntax-highlighted PKGBUILD review inside the normal review/diff flow. This request is specifically about the yay -Gp stdout path and making the viewer/highlighter configurable so it works seamlessly for repeated use.
Source: Jguer/yay