Konfiguracja

Plik konfiguracji projektu

Snapper szuka pliku .snapperrc.toml począwszy od bieżącego katalogu w górę aż do korzenia systemu plików. Przesłoń wyszukiwanie za pomocą --config path/to/config.toml.

Or generate one with snapper init.

Format konfiguracji

# Language for abbreviation sets (en, de, fr, is, pl)
lang = "en"

# Extra abbreviations (merged with built-in list for the selected language)
extra_abbreviations = ["GROMACS", "LAMMPS", "DFT"]

# File patterns to ignore (glob syntax)
ignore = ["*.bib", "*.cls", "*.sty"]

# Default format (overridden by --format flag)
format = "org"

# Maximum line width (0 = unlimited, overridden by --max-width flag)
max_width = 0

# Per-format overrides
[org]
extra_abbreviations = ["PROPERTIES", "DEADLINE"]

[latex]
extra_abbreviations = ["Thm", "Lem"]
max_width = 100

# Per-language code-block comment reflow and optional formatters.
# Used when the parser emits a Region::Code with a matching language.
# --format-code runs `formatter` on the block body after comment reflow.
[code.rust]
line_comment = "//"
block_comment = ["/*", "*/"]
formatter = ["rustfmt", "--edition", "2024"]

[code.python]
line_comment = "#"
block_comment = ["\"\"\"", "\"\"\""]
formatter = ["ruff", "format", "-"]

Pola

lang

String. Language code for the built-in abbreviation set used by the rule-based splitter. One of: en (default), de, fr, is, pl. Also selectable via --lang CLI flag.

extraabbreviations

String array. Each entry names an abbreviation that should not trigger a sentence break when followed by a period. Merged with the built-in list for the selected language. Useful for domain-specific terms your papers use frequently.

ignore

Tablica ciągów znaków ze wzorcami glob. Pliki pasujące do tych wzorców są pomijane podczas operacji --in-place i --check. Nie wpływa na tryb stdin/stdout.

format

String. Default format when auto-detection from file extension does not apply. One of: org, latex, markdown, rst, plaintext.

maxwidth

Integer. Sentences exceeding this width get wrapped at word boundaries. Set to 0 for unlimited (the default). Also respects max_line_length from .editorconfig if present.

Per-format sections

Add [org], [latex], [markdown], [rst], or [plaintext] sections to override settings for specific formats.

Per-format extra_abbreviations merge with the top-level list. Per-format max_width overrides the top-level value.

Code-block sections ([code.<lang>])

Each [code.<lang>] table configures how fenced or delimited source blocks for that language are handled. snapper init writes seed entries for common languages (rust, python, toml, lua, lisp, html, javascript).

linecomment

String. Marker for single-line comments (for example "//" or "#"). Comment text after the marker is reflowed with the sentence splitter; the marker and indentation are preserved.

blockcomment

String array of length two: open and close markers (for example ["/*", "*/"]). One-line and multi-line block comments are reflowed as prose between the markers.

formatter

String array treated as argv for std::process::Command. Only runs when the CLI flag --format-code is set. Missing binaries, non-zero exits, and a ~30s watchdog timeout each leave the reflowed body in place (non-fatal).

If a language has no [code.<lang>] entry (or the fence has no language), the block body passes through unchanged aside from normal trailing-newline preservation.

Kolejność priorytetów

CLI flags override config file values. Per-format sections override top-level config values. Config file values override .editorconfig values. .editorconfig overrides built-in defaults.