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.

The settings are explained below:

Table [layout]

  • editor-tag: If set, the value of this setting is used as the default editor tag.
  • column-tag: If set, the value of this setting is used as the default column tag.
  • window-tag: If set, the value of this setting is used as the default window tag.

Table [typesetting]

  • replace-cr-with-tofu: when set to true, Anvil shows carriage-return characters as the "tofu" character (a box). When false (the default) carriage-return characters are shown as whitespace.

Table [ssh]

  • shell: shell specifies the shell to use when commands are executed on a remote system. The default is "sh".
  • close-stdin: close-stdin controls if stdin is closed for remote programs when they are executed using middle-click. Some programs require this to operate properly such as ripgrep, while others require stdin to be open even if it is not read, like man(1). The default is false.
  • conn-timeout: This setting specifies the SSH connection timeout in seconds

Table [env]

The values in this table define additional environment variables that will be set by Anvil when it executes an OS command. For example, if this section is defined as:

[env]
EDITOR="aedit"
PAGER="less"

then Anvil would set the environment variable EDITOR to aedit, and PAGER to less in the environment of programs it executes.

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)