Aller au contenu

Startup Layout

The Startup Layout feature lets you define which files open automatically when Fern starts, and how the editor area is divided into panes. This is set per vault in {vault}/.fern/config.toml.


Overview

When a [layout] section is present in your vault config, Fern builds a split-pane view from the layout tree you defined instead of opening the last file or a blank editor.


How the layout tree works

A layout is a binary tree of nodes. Each node is either:

  • A leaf - opens one or more tabbed files in a pane.
  • A branch - splits the pane area in two and places a child node in each half.

Branch nodes have a split key ("vertical" or "horizontal") and two children:

split value Child keys used Result
"vertical" left, right Side-by-side panes
"horizontal" top, bottom Stacked panes

Leaf nodes have a tabs array where each entry specifies a file to open as a tab in that pane. Each tab entry has a file key and an optional mode key.

As a shorthand, you can set file (and optionally mode) directly on a leaf node instead of writing a one-entry tabs array. The two forms are equivalent.


File references

The file value in a tab entry accepts three forms:

Form Example Opens
Journal shorthand "journal:day" Today's daily journal
Vault-relative path "notes/project.md" That file inside the vault root
Absolute path "/home/user/shared/ref.md" That exact file on disk

Valid journal periods are day, week, month, and year.


Per-tab mode override

By default every tab opens in whatever start_mode is configured ("edit" or "view"). You can override this per tab with the mode key:

[layout.left]
tabs = [{file = "journal:day", mode = "view"}]

Valid values are "view" and "edit".


Examples

Single file

Open one file on startup without splitting the editor area:

[layout]
file = "notes/index.md"

Two panes side by side

Daily journal on the left, weekly journal on the right:

[layout]
split = "vertical"

[layout.left]
tabs = [{file = "journal:day"}]

[layout.right]
tabs = [{file = "journal:week"}]

Multiple tabs in one pane

Daily journal on the left, two tabs on the right (weekly journal and a project note opened read-only):

[layout]
split = "vertical"

[layout.left]
tabs = [{file = "journal:day"}]

[layout.right]
tabs = [{file = "journal:week"}, {file = "notes/project.md", mode = "view"}]

Three panes

Daily journal on the left (read-only), weekly journal top-right, a project note bottom-right:

[layout]
split = "vertical"

[layout.left]
tabs = [{file = "journal:day", mode = "view"}]

[layout.right]
split = "horizontal"

[layout.right.top]
tabs = [{file = "journal:week"}]

[layout.right.bottom]
tabs = [{file = "notes/project.md"}]

Notes

  • The layout is a vault-level-only setting. It lives in {vault}/.fern/config.toml and cannot be set in the global config.
  • If a file reference cannot be resolved (for example a journal period with no matching file), the pane for that leaf is silently skipped.
  • The layout takes effect on startup and when you switch vaults with :vaultSwitch.