Editor Integration¶
Emacs (Apheleia)¶
Apheleia runs external formatters on buffer save, preserving cursor position.
(with-eval-after-load 'apheleia
(push '(snapper . ("snapper" "--format" "org")) apheleia-formatters)
(push '(org-mode . snapper) apheleia-mode-alist)
;; Add for other formats:
(push '(latex-mode . snapper) apheleia-mode-alist)
(push '(markdown-mode . snapper) apheleia-mode-alist))
The --format flag auto-detects from the file extension, so you can omit it if your files have standard extensions.
Vim / Neovim¶
Use formatprg to pipe through snapper:
autocmd FileType org setlocal formatprg=snapper\ --format\ org
autocmd FileType tex setlocal formatprg=snapper\ --format\ latex
autocmd FileType markdown setlocal formatprg=snapper\ --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 = { "--format", "$FILETYPE" },
stdin = true,
},
},
formatters_by_ft = {
org = { "snapper" },
tex = { "snapper" },
markdown = { "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 --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¶
Install the snapper plugin from Obsidian Community Plugins (Settings > Community Plugins > Browse > search “Snapper”).
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.
For manual installation (before the plugin is listed in Community Plugins):
Download
main.jsandmanifest.jsonfrom GitHub ReleasesCopy both files to
.obsidian/plugins/snapper/in your vaultEnable the plugin in Settings > Community Plugins
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.
Install from AppSource¶
In Word: Insert > Get Add-ins > search “Snapper”.
Sideloading (development)¶
Download the add-in ZIP from GitHub Releases
In Word: Insert > My Add-ins > Upload My Add-in
Select the
manifest.xmlfrom the extracted ZIP
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 --format org