Pretty Print R Code in the Terminal
Replace the standard print method for functions with one that performs syntax highlighting, using ANSI colors, if the terminal supports them.
Stable version:
install.packages("prettycode")
Development version:
# pak::pak("r-lib/prettycode")
install.packages("prettycode", repos = c('https://r-lib.r-universe.dev', 'https://cloud.r-project.org'))
Just call prettycode::prettycode() and start printing functions to the
screen. Long functions are automatically paged using the default pager.

prettycode.should_page controls paging. Use FALSE to disable paging for long functions.MIT © Gábor Csárdi