Sources/Orgstar/Preferences.swift

f00fcfad5a1c851204ac36fe0f968a34a11cadf6
orgstar/Sources/Orgstar/Preferences.swift

28 lines · 1180 bytes

 1import Foundation
 2import OrgApp
 3import OrgCore
 4
 5/// Org preferences, stored in user defaults by the Settings window.
 6enum Preferences {
 7    static let defaultTodoKeywords = "TODO PROJ LOOP STRT WAIT HOLD IDEA | DONE KILL"
 8
 9    /// TODO keywords for files without `#+TODO`, read at launch.
10    @MainActor
11    static var orgSettings: OrgSettings {
12        // config.toml applies before anything reads settings.
13        ConfigSync.shared.start()
14        let line = UserDefaults.standard.string(forKey: "todoKeywords") ?? defaultTodoKeywords
15        return OrgSettings.default.withTodoKeywords(line) ?? .default
16    }
17
18    static func options(
19        tagsColumn: Int, headingAfterSubtree: Bool, splitLine: Bool, alphabeticalLists: Bool, fillColumn: Int,
20        hiddenMarkers: Bool, prettyEntities: Bool
21    ) -> EditingOptions {
22        EditingOptions(
23            tagsColumn: tagsColumn, insertHeadingRespectContent: headingAfterSubtree,
24            metaReturnMaySplitLine: splitLine, listAllowAlphabetical: alphabeticalLists, fillColumn: fillColumn,
25            hideEmphasisMarkers: hiddenMarkers, prettyEntities: prettyEntities, subSuperscriptsNeedBraces: true
26        )
27    }
28}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form