Crates.io | tortilla |
lib.rs | tortilla |
version | 0.1.0 |
created_at | 2025-08-18 08:57:39.316249+00 |
updated_at | 2025-09-01 21:12:49.086631+00 |
description | Somewhat syntax-aware text wrapping for source code and plain text documents |
homepage | https://codeberg.org/satoqz/tortilla#readme |
repository | https://codeberg.org/satoqz/tortilla |
max_upload_size | |
id | 1800116 |
size | 60,268 |
Somewhat syntax-aware text wrapping for source code and plain text documents.
This is both a Rust crate and a corresponding command line tool for text wrapping, with some assumptions that are specific to code comments and plain text documents (e.g., markdown documentation or emails).
In particular, the following features are supported:
//
, #
, etc.)-
, *
, 1.
,
etc.)--tabs
)--salsa
), this is the default--guacamole
) as a less resource-intensive alternativeI like to hard wrap my code comments and plain text documents. It's a rough reality, but it makes them easier to read, review and maintain, and soft-wrapping is a highly subpar alternative. In many cases I want an automated initial pass at hard wrapping, and then follow up with any (rare) manual edits.
Text editors tend to provide hard wrapping functionality to some degree,
but usually have limited understanding of indentation, comment tokens or
bulleted/numbered lists. This project was born out of my frustrations wrapping
text in the Helix editor via the :reflow
command,
which uses the popular textwrap crate.
Via cargo:
cargo install tortilla
$ tortilla --help
Usage: tortilla [-h, --help] [--width <WIDTH>] [--tabs <TABS>] [--crlf] [--salsa] [--guacamole]
Input is read from stdin, output is written to stdout. For example:
$ echo "foo bar baz" | tortilla --width 8
foo bar
baz
Tortilla wraps to 80 characters with LF (\n
) newlines by default, counting tab
indents as 4 spaces.
For Helix, I suggest the following:
keys.normal."=" = ":pipe tortilla"
Add the tortilla
crate to your Rust project:
cargo add tortilla
See docs.rs/tortilla for documentation.
Licensed under either of Apache License, Version 2.0 or MIT License at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.