Documentation
¶
Overview ¶
Package config loads, parses, and holds Fern's runtime configuration.
Index ¶
- Constants
- func ConfigFilePath() string
- func DetectEditor() (string, error)
- func EnsureConfigFileExists(path string) error
- func EnsureShareDirExists() error
- func ExpandPath(path string) string
- func LoadState() fernState
- func SaveState(s fernState) error
- func ShareDirPath() string
- func StateFilePath() string
- type Config
- type Keys
- type ViewerKeys
Constants ¶
const Version = "0.2.0"
Version is the current application version string.
Variables ¶
This section is empty.
Functions ¶
func ConfigFilePath ¶
func ConfigFilePath() string
ConfigFilePath returns path to ".config/fern/config".
func DetectEditor ¶
DetectEditor returns the user's preferred editor from $EDITOR, $VISUAL, $FCEDIT, or a PATH search of common fallback editors.
func EnsureConfigFileExists ¶
EnsureConfigFileExists creates an empty config file if it doesn't exist.
func EnsureShareDirExists ¶
func EnsureShareDirExists() error
EnsureShareDirExists creates the share directory if it doesn't exist.
func ExpandPath ¶
ExpandPath expands a leading ~/ and environment variables in path.
func LoadState ¶
func LoadState() fernState
LoadState reads app state from the state file. Returns defaults when the file doesn't exist (fresh install). Paths in the returned struct are expanded.
func ShareDirPath ¶
func ShareDirPath() string
ShareDirPath returns the XDG data directory for fern: ~/.local/share/fern.
func StateFilePath ¶
func StateFilePath() string
StateFilePath returns the path to the fern state file inside the share dir.
Types ¶
type Config ¶
type Config struct {
Vault string
Vaults []string
Ext string
TodayTemplate bool
StartJournals []string
ShowSidebar bool
NotesDir string
JournalsDir string
TemplatesDir string
BookmarksFile string
DailyTemplate string
WeeklyTemplate string
MonthlyTemplate string
YearlyTemplate string
FoldLevel int
TabSpaces int
SortNotes string
SortJournals string
SortTemplates string
Theme string
StartMode string
WeekStart string // "monday" or "sunday"
AutoJournalPeriods bool // auto-open period logs on startup when today is a period boundary
LinkFormat string // "wiki" or "markdown"
NoteFrontmatter bool // true = scaffold new notes with title/date/tags frontmatter
FuzzySearch bool // true = append * to bare FTS query terms (prefix matching)
CheckboxStates []string
Keys Keys
ViewerKeys ViewerKeys
}
Config holds the full runtime configuration for a Fern session.
func (*Config) FormatLink ¶
FormatLink returns a link string in the configured format. title is the display name; path is the vault-relative path without extension.
func (*Config) HasMultipleVaults ¶
HasMultipleVaults reports whether more than one vault is configured.
func (*Config) SaveState ¶
SaveState persists the active vault, vaults list, and sidebar visibility to the share state file.
func (*Config) SwitchVault ¶
SwitchVault updates the active vault path and all derived directory fields in c.
type Keys ¶
type Keys struct {
Quit string
Search string
Command string
Help string
Edit string
SectionNotes string
SectionJournals string
SectionTemplates string
Sidebar string
CloseTab string
NextTab string
PrevTab string
MoveTabLeft string
MoveTabRight string
SortField string
SortDir string
Palette string
}
Keys holds the application-level keybinding strings.
func DefaultKeys ¶
func DefaultKeys() Keys
DefaultKeys returns the built-in default application key bindings.
type ViewerKeys ¶
type ViewerKeys struct {
MoveDown string
MoveUp string
MoveLeft string
MoveRight string
WordForward string
WordBackward string
LineStart string
LineEnd string
HalfPageDown string
HalfPageUp string
GotoPrefix string
GotoEnd string
Undo string
Redo string
InsertMode string
AppendEnd string
AppendAfter string
InsertAtStart string
ReplaceMode string
NewLineBelow string
NewLineAbove string
ToggleCheckbox string
InsertCheckbox string
VisualMode string
VisualLineMode string
Paste string
ReplacePrefix string
DeleteChar string
DeletePrefix string
Yank string
Cut string
Change string
SearchSelection string
FoldPrefix string
Escape string
}
ViewerKeys holds user-configurable keybinding strings for the viewer. Each field is a comma-separated list of key names (e.g. "j,down"). An empty string means "keep the built-in default".