Documentation
¶
Overview ¶
Package settings stores ZPad's preferences in the user data directory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Settings ¶
type Settings struct {
Theme string `json:"theme"` // system | light | dark | a named theme id
Language string `json:"language"` // "" follows the system, else zh-Hans | en
FontFamily string `json:"fontFamily"` // "" is the system's monospaced font
FontSize float32 `json:"fontSize"`
LineHeight float32 `json:"lineHeight"`
SoftWrap bool `json:"softWrap"`
LineNumbers string `json:"lineNumbers"` // absolute | relative | off
TabSize int `json:"tabSize"`
UseTabs bool `json:"useTabs"`
ShowGuides bool `json:"showGuides"`
// Whitespace says where spaces show as dots and tabs as arrows:
// selection | none | all | trailing.
Whitespace string `json:"whitespace"`
AutoClose bool `json:"autoClose"`
// VimMode makes every editor modal: normal, insert and visual modes,
// with Vim's motions and operators. It is off by default.
VimMode bool `json:"vimMode"`
DefaultEncoding string `json:"defaultEncoding"` // utf-8 | utf-8-bom | utf-16le | utf-16be | gb18030
DefaultEOL string `json:"defaultLineEnding"` // "\n" | "\r\n" | "\r"
LargeFileMB int `json:"largeFileMB"`
SidebarOpen bool `json:"sidebarOpen"`
SidebarWidth float32 `json:"sidebarWidth"`
ShowHidden bool `json:"showHidden"`
RestoreSession bool `json:"restoreSession"`
ConfirmClose bool `json:"confirmClose"`
// PreviewTabs opens a file clicked in the workspace tree as a preview
// tab: the next click replaces it, and a double click, an edit or a
// save keeps it. Turning it off opens every click for good.
PreviewTabs bool `json:"previewTabs"`
// KeepUnsaved keeps unsaved content, including untitled documents, in
// the user data directory and restores it on the next launch, instead
// of asking to save it when the window closes or the app quits.
KeepUnsaved bool `json:"keepUnsaved"`
}
Settings is everything ZPad remembers between launches.
Fields are exported so the view can read them directly and tests can build values without a constructor. Missing fields in an older file keep the defaults of Default.