tergo
tergo
is a lightning-fast R code formatter powered by
Rust, designed for developers who prioritize speed and efficiency.
Whether you’re optimizing CI pipelines or building responsive developer
tools, tergo
reformats R code in milliseconds.
No Rust tooling required. Binaries are pre-built:
install.packages('tergo', repos = c(
'https://kpagacz.r-universe.dev',
'https://cloud.r-project.org'
))
Requires Rust toolchain:
if (!require(remotes)) install.packages("remotes")
remotes::install_github("kpagacz/tergo@latest", subdir = "antidotum/tergo")
Style your entire R package:
tergo::style() # Run in package root directory
Style specific files/directories:
Customize formatting via tergo.toml
in your package root
or through function arguments.
Option | Type | Default | Description |
---|---|---|---|
indent |
integer | 2 | Spaces per indent level |
line_length |
integer | 120 | Maximum line length before wrapping |
embracing_op_no_nl |
boolean | TRUE | Remove line breaks in {{ }} (ref) |
allow_nl_after_assignment |
boolean | FALSE | Permit line breaks after = , <- ,
:=
|
space_before_complex_rhs_in_formula |
boolean | TRUE | Add space before complex RHS in formulas (ref) |
strip_suffix_whitespace_in_function_defs |
boolean | TRUE | Trim trailing whitespace in functions |
function_line_breaks |
string | “hanging” |
"single" /"double" /"hanging"
function argument formatting (ref) |
insert_newline_in_quote_call |
boolean | TRUE | Add newlines in long quote() calls |
tergo
?
Verify performance claims using included benchmarks:
source(system.file("bench.R", package = "tergo"))
Maintain different .toml
files for multiple
projects:
tergo::style(config = "path/to/alternate.toml")
Next Steps:
• Run ?tergo::style
for detailed function
documentation
• Visit GitHub repository
for issue tracking
• Experiment with different .toml
configurations to match
your team’s style guide ```