Editor Integration¶
Emacs (Apheleia)¶
Apheleia runs external formatters on buffer save, preserving cursor position.
(with-eval-after-load 'apheleia
(push '(snapper-org . ("snapper" "--native" "--format" "org")) apheleia-formatters)
(push '(snapper-latex . ("snapper" "--native" "--format" "latex")) apheleia-formatters)
(push '(snapper-md . ("snapper" "--native" "--format" "markdown")) apheleia-formatters)
(push '(org-mode . snapper-org) apheleia-mode-alist)
(push '(latex-mode . snapper-latex) apheleia-mode-alist)
(push '(markdown-mode . snapper-md) apheleia-mode-alist))
--format does not auto-detect from the buffer name.
Each mode must pass the matching format token (org, latex, markdown, rst, plaintext).
Vim / Neovim¶
Use formatprg to pipe through snapper:
autocmd FileType org setlocal formatprg=snapper\ --native\ --format\ org
autocmd FileType tex setlocal formatprg=snapper\ --native\ --format\ latex
autocmd FileType markdown setlocal formatprg=snapper\ --native\ --format\ markdown
Then gq to reformat selected text, or gggqG to reformat the entire buffer.
For Neovim with conform.nvim:
require("conform").setup({
formatters = {
snapper = {
command = "snapper",
args = { "--native", "--stdin-filepath", "$FILENAME" },
stdin = true,
},
},
formatters_by_ft = {
org = { "snapper" },
tex = { "snapper" },
markdown = { "snapper" },
rst = { "snapper" },
},
})
VS Code extension (recommended)¶
Install TurtleTech.snapper from the VS Code Marketplace.
The extension provides:
Format-on-save via the built-in LSP server
Range formatting (format just the selected text)
Diagnostics (flags lines with multiple sentences)
Code actions (quick fixes to split multi-sentence lines)
Status bar indicator showing LSP connection state
Project configuration via
.snapperrc.toml
To format on save, add to your settings.json:
{
"editor.formatOnSave": true,
"[markdown]": { "editor.defaultFormatter": "TurtleTech.snapper" },
"[latex]": { "editor.defaultFormatter": "TurtleTech.snapper" },
"[org]": { "editor.defaultFormatter": "TurtleTech.snapper" }
}
To use a custom binary path:
{
"snapper.path": "/path/to/snapper"
}
The extension also works with VSCodium and code-oss (Arch Linux).
Download the .vsix from GitHub Releases and install manually if the Marketplace is unavailable.
Manual VS Code setup (without extension)¶
Use the “Run on Save” extension with a custom command:
{
"emeraldwalk.runonsave": {
"commands": [
{
"match": "\\.(org|tex|md|rst)$",
"cmd": "snapper --native --in-place ${file}"
}
]
}
}
LSP (any editor with LSP support)¶
Snapper ships a Language Server Protocol implementation. Start it with:
snapper lsp
This provides document formatting, range formatting, and diagnostics (flags lines with multiple sentences) over the standard LSP protocol on stdin/stdout.
Neovim (snapper.nvim plugin)¶
The snapper.nvim plugin (in editors/nvim/) handles LSP lifecycle, format-on-save, keymaps, and conform.nvim integration.
See the plugin README for installation and configuration.
For manual LSP setup without the plugin:
vim.api.nvim_create_autocmd("FileType", {
pattern = { "org", "tex", "markdown" },
callback = function()
vim.lsp.start({
name = "snapper",
cmd = { "snapper", "lsp" },
})
end,
})
Emacs (eglot)¶
(add-to-list 'eglot-server-programs
'((org-mode latex-mode markdown-mode) "snapper" "lsp"))
VS Code¶
Add to settings.json (requires a generic LSP client extension):
{
"lsp.servers": {
"snapper": {
"command": "snapper",
"args": ["lsp"],
"filetypes": ["org", "tex", "markdown"]
}
}
}
Helix¶
Add to ~/.config/helix/languages.toml:
[[language]]
name = "org"
language-servers = ["snapper"]
[language-server.snapper]
command = "snapper"
args = ["lsp"]
Obsidian¶
Development preview; not listed in Community Plugins.
The plugin uses a WebAssembly build of snapper – no binary installation needed.
Commands:
“Format entire note” – formats the active note
“Format selection” – formats the selected text
Settings: format-on-save, max line width, language, extra abbreviations. Format auto-detects from the note’s file extension.
The repository does not publish an installable Obsidian artifact.
Development builds use the source in editors/obsidian and the build sequence in .github/workflows/wasm.yml.
Microsoft Word¶
The snapper Word add-in provides a task pane for formatting documents with semantic line breaks. It uses a WebAssembly build – no binary installation needed.
Availability¶
Development preview; not published in AppSource.
Sideloading (development)¶
Build the WASM wrapper and Word add-in using the source under packages/snapper-wasm and editors/word.
The .github/workflows/wasm.yml build sequence is the executable reference.
Sideload editors/word/manifest.xml after starting the local development server described in editors/word/README.md.
The task pane provides:
“Format Document” – formats all paragraphs
“Format Selection” – formats the selected text
Settings for max width, language, and extra abbreviations
Generic (any editor)¶
Snapper reads stdin and writes stdout by default. Any editor that supports piping through an external program works:
cat paper.org | snapper --native --format org