Document preview
Development reference · View source
In the desktop window, :preview captures selected text, or the
whole current buffer when the selection is a bare caret. It includes unsaved
edits and leaves the source text and selection intact. Multiple nonempty ranges
are joined in document order with a newline. A selected SVG diagram is rendered
graphically even inside a Markdown or source document.
Desktop packages include preview in the editor executable, including inside local macOS app bundles. The Linux x86-64 and ARM64 desktop release archives require glibc 2.39 or newer and the native runtime dependencies; the terminal archives and curl installer remain separate. See the desktop packaging guide . For a checkout build, use the preview instructions . Markdown uses proportional GitHub-like typography; static HTML and SVG render graphically. JSON is pretty-printed when valid and retains its original text with a diagnostic otherwise. YAML retains its comments, structure and ordering. Source code uses available syntax highlighting; other text uses monospace.
Generated pages — Markdown, JSON, YAML, source and plain text — take the active
theme’s colours: its background and text, its link and heading colours, and
its syntax colours for highlighted code. Switching theme or the setting
repaints an open preview. Set editor.preview_theme_colors to false to keep
the original light page. Static HTML and valid SVG keep the appearance they
were written with; HTML that styles itself through prefers-color-scheme
follows whether the theme is dark or light.
Wheel/trackpad scrolling preserves fractional pixels; Shift-wheel pans horizontally.
The preview also uses the built-in PDF navigation keys: j/k and arrows,
h/l, page/half-page controls, gg/ge, and +/- zoom (z1 resets).
Left-drag selects text; y or Ctrl-Shift-c copies it. Escape dismisses an overlay
first, then returns to source; q also returns to source. A dismissed preview
stays closed when switching workspaces or reattaching to its persistent session.
Invoke :preview again to refresh. Links expose their destination without
navigating. Scripts and network fetching are disabled. Local raster images must
be beneath the source document’s directory. Captures are limited to 128 KiB;
selecting a smaller section of a larger file is supported. The terminal frontend
reports that this command needs --window. See the preview instructions for
resource limits, lifecycle and tested static CSS/SVG support.