Skip to content

Editor Modelines

Igor Khanin edited this page Jun 3, 2025 · 6 revisions

Katvan supports overriding editor settings on a per-document basis by the use modelines. These are modeled after, and compatible with, the modelines used by Kate.

Structure of Modelines

A modeline is a line with starts with the either the prefix katvan: or the prefix kate: and followed by a semicolon separated list of configuration variables to be overridden for the containing file and their new value. Multiple modelines are allowed in the same file - setting values that appear later take precedence. To avoid compilation issues, modelines should of course be placed within Typst comments.

Examples:

// katvan: replace-tabs on; indent-width 4;

/* kate: font-size 14; font Arial; */

Notes

  • Only modelines that appear in the first 10 lines of a file are considered.
  • Changes to modeline values become effective on the next file save.
  • Unrecognized variable names, or variables with invalid values, are ignored.
  • A trailing semicolon is not mandatory, but is important for eliminating ambiguity on the end of a modeline - especially if in a multi-line comment.

Available Variables

For these variables, there are three types of supported values:

  • BOOL: one of on, true or 1 to enable, or off, false or 0 to disable.
  • INTEGER: any decimal integer value (although some variables may have additional restrictions).
  • STRING: everything else.
Variable Name Type Restrictions Description Since Version
font STRING Name of font family to use for file text in the editor 0.4.0
font-size INTEGER Must be positive Size in points for font to use for file text in the editor 0.4.0
indent-width INTEGER Must be non-negative If indenting with spaces, the number of spaces used 0.4.0
replace-tabs BOOL If enabled, use spaces to indent. If disabled, use tabs 0.4.0
tab-width INTEGER Must be non-negative Display width of tabs (in characters) 0.4.0
show-line-numbers STRING One of both, primary or none 0.5.0
indent-mode STRING Auto-indentation mode. One of none, normal or smart 0.6.0
show-control-chars BOOL If enabled, show BiDi control characters in the editor 0.8.0
auto-brackets BOOL If enabled, automatically inserts closing brackets 0.9.0
auto-trigger-completions BOOL If enabled, automatically show auto-complete suggestions 0.10.0
scheme STRING One of auto, light or dark 0.10.0
Clone this wiki locally