Skip to content

Configuration Files

Anvil loads various configuration files on startup from its configuration directory. The Anvil configuration directory is a subdirectory named .anvil under $HOME on Linux, or %USERPROFILE% on Windows. Running the 'About' command in Anvil shows the path to the config directory on the line beginning with 'Config directory:', and like any path can be opened in Anvil using ALT-Right Click.

If the configuration directory is not present, or a configuration file that Anvil would load is not present, then Anvil uses default values.

The list of configuration files is below. The settings.toml and style.js config files are described in the following sections, while the plumbing and sshkeys configuration have their own pages.

  • settings.toml: Miscellaneous settings for Anvil
  • style.js: Defines Anvil's style: the colors and fonts used for UI elements.
  • plumbing: Defines the plumbing rules
  • sshkeys/: a subdirectory containing SSH keys used for remote editing

settings.toml

This file contains miscellaneous settings for Anvil in TOML format. Use the command PrintCfg settings.toml to print the contents of a sample configuration file to the +Errors window, which includes comments explaining the purpose of the settings. The contents can be saved to the file settings.toml in the configuration directory.

style.js

This file defines Anvil's style in JSON format which define the colors and fonts used for UI elements. Anvil only supports TTF fonts. All color related settings must be specified as strings which are three-channel hex color codes beginning with a pound, for example: "#f0f0f0".

The settings are explained below:

  • Fonts: This array defines the list of fonts that Anvil uses. Each element in the list is an object with the fields FontName and FontSize. In an Anvil window these fonts can be cycled through by using the command Font.

    • FontName may be set to the full path to a TTF font file, the name of a font in platform specific user and system font directories, or one of the special values defaultVariableFont or defaultMonoFont. The values defaultVariableFont and defaultMonoFont refer to internal fonts built into Anvil, and are a variable-width and monospace font respectively. For paths and names, Go uses the findfont library to locate the fonts.
  • TagFgColor, TagBgColor: The foreground and background colors of the window, column and editor tags.

  • BodyFgColor, BodyBgColor: The foreground and background colors of window bodies.
  • LayoutBoxFgColor, LayoutBoxUnsavedBgColor, LayoutBoxBgColor: The layout box outline color, the fill color for an unsaved file, and the fill color for a saved file respectively.
  • ScrollFgColor, ScrollBgColor: The color of the "button" and background of window scrollbars
  • GutterWidth: The width of the column on the left side of a window that contains the scrollbar and layout box in pixels
  • WinBorderColor: The color of the border around a window
  • WinBorderWidth: The width in pixels of the border around a window
  • PrimarySelectionFgColor, PrimarySelectionBgColor: The foreground and background colors of the primary selection
  • SecondarySelectionFgColor, SecondarySelectionBgColor: The foreground and background colors of secondary selections
  • ErrorsTagFgColor, ErrorsTagBgColor: The foreground and background colors of the tags of +Errors windows
  • TabStopInterval: The distance between each tabstop in the window body
  • Syntax: This setting is an object with fields to colorize various syntax-highlighting elements. The supported colors are:
    • KeywordColor: Keywords
    • NameColor: Names/identifiers
    • StringColor: Strings
    • NumberColor: Numbers
    • OperatorColor: Operators
    • CommentColor: Comments
    • PreprocessorColor: Preprocessor statements (C and C++)
    • HeadingColor: Headings (for example in Markdown)
    • SubheadingColor: Subheadings
    • InsertedColor: Inserted text (for diffs)
    • DeletedColor: Deleted text (for diffs)