Documentation
¶
Overview ¶
Package config loads application and repository configuration from YAML.
Index ¶
- Constants
- func CustomCommandHasKeyBinding(key string) bool
- func CustomThemesToThemeDataMap(customThemes map[string]*CustomTheme) map[string]*theme.CustomThemeData
- func DefaultDeltaArgsForTheme(themeName string) []string
- func IsPaletteOnlyCommandKey(key string) bool
- func NormalizeThemeName(name string) string
- func PaletteOnlyCommandName(key string) string
- func SaveConfig(cfg *AppConfig) error
- func SyntaxThemeForUITheme(themeName string) string
- type AppConfig
- type CommitConfig
- type ContainerCommand
- type ContainerMount
- type CustomCommand
- type CustomCommandsConfig
- type CustomCreateMenu
- type CustomTheme
- type KeybindingsConfig
- type LayoutSizes
- type RepoConfig
- type TmuxCommand
- type TmuxWindow
Constants ¶
const ( NoteTypeSplitted = "splitted" NoteTypeOneJSON = "onejson" )
Note type constants for WorktreeNoteType configuration.
const ( PaneWorktrees = "worktrees" PaneInfo = "info" PaneStatus = "status" PaneLog = "log" PaneNotes = "notes" PaneAgentSessions = "agent_sessions" PaneUniversal = "universal" )
Pane name constants used for keybinding and command dispatch.
Variables ¶
This section is empty.
Functions ¶
func CustomCommandHasKeyBinding ¶ added in v1.42.0
CustomCommandHasKeyBinding reports whether the key should be matched against direct keyboard input.
func CustomThemesToThemeDataMap ¶ added in v1.25.0
func CustomThemesToThemeDataMap(customThemes map[string]*CustomTheme) map[string]*theme.CustomThemeData
CustomThemesToThemeDataMap converts a map of CustomTheme to theme.CustomThemeData.
func DefaultDeltaArgsForTheme ¶ added in v1.8.0
DefaultDeltaArgsForTheme returns the default delta arguments for a given theme.
func IsPaletteOnlyCommandKey ¶ added in v1.42.0
IsPaletteOnlyCommandKey reports whether a custom command is palette-only. Keys prefixed with "_" remain available in the command palette, but they are not bound to a direct keyboard shortcut in the main TUI.
func NormalizeThemeName ¶ added in v1.8.0
NormalizeThemeName returns the normalized theme name if valid, otherwise empty string.
func PaletteOnlyCommandName ¶ added in v1.42.0
PaletteOnlyCommandName returns the palette-visible identifier without the leading "_" marker.
func SaveConfig ¶ added in v1.22.0
SaveConfig writes the configuration back to the file. It tries to preserve existing fields by reading the file first.
func SyntaxThemeForUITheme ¶ added in v1.6.0
SyntaxThemeForUITheme returns the syntax theme name for a given TUI theme.
Types ¶
type AppConfig ¶
type AppConfig struct {
WorktreeDir string
InitCommands []string
TerminateCommands []string
SortMode string // Sort mode: "path", "active" (commit date), "switched" (last accessed)
AutoFetchPRs bool
DisablePR bool // Disable all PR/MR fetching and display
SearchAutoSelect bool // Start with filter focused and select first match on Enter.
MaxUntrackedDiffs int
MaxDiffChars int
MaxNameLength int // Maximum length for worktree names in table display (0 disables truncation)
GitPagerArgs []string
GitPagerArgsSet bool `yaml:"-"`
GitPager string
GitPagerInteractive bool // Interactive tools need terminal control, skip piping to less
GitPagerCommandMode bool // Command-mode tools run their own git commands (e.g. lumen diff)
TrustMode string
DebugLog string
Pager string
CIScriptPager string // Pager for CI check logs, implicitly interactive
Editor string
AutoRefresh bool
CIAutoRefresh bool // Periodically refresh CI status (GitHub only, uses API rate limits)
RefreshIntervalSeconds int
CustomCommands CustomCommandsConfig
Keybindings KeybindingsConfig
BranchNameScript string // Script to generate branch name suggestions from diff
WorktreeNoteScript string // Script to generate worktree notes from PR/issue content
WorktreeNotesPath string // Optional path to a single shared JSON file for worktree notes
WorktreeNoteType string // Note storage type: "onejson" (default) or "splitted"
Theme string // Theme name: see AvailableThemes in internal/theme
MergeMethod string // Merge method for absorb: "rebase" or "merge" (default: "rebase")
FuzzyFinderInput bool // Enable fuzzy finder for input suggestions (default: false)
IconSet string // Icon set: "nerd-font-v3", "text" (default: "nerd-font-v3"). Legacy "emoji" and "none" map to "text".
IssueBranchNameTemplate string // Template for issue branch names with placeholders: {number}, {title} (default: "issue-{number}-{title}")
PRBranchNameTemplate string // Template for PR branch names with placeholders: {number}, {title}, {generated}, {pr_author} (default: "pr-{number}-{title}")
SessionPrefix string // Prefix for tmux/zellij session names (default: "wt-")
Layout string // Pane arrangement: "default" or "top" (default: "default")
PruneStaleBranches bool // Include merged branches without worktrees in prune (default: false)
PaletteMRU bool // Enable MRU sorting for command palette (default: false)
PaletteMRULimit int // Number of MRU items to show (default: 5)
AgentSessionClaudeRoot string // Custom root for Claude transcript discovery (default: ~/.claude/projects)
AgentSessionPiRoot string // Custom root for pi transcript discovery (default: ~/.pi/agent/sessions)
CustomCreateMenus []*CustomCreateMenu
CustomThemes map[string]*CustomTheme // User-defined custom themes
LayoutSizes *LayoutSizes // Configurable pane size weights (nil = use defaults)
ConfigPath string `yaml:"-"` // Path to the configuration file
DeprecationWarnings []string `yaml:"-"` // Warnings about deprecated config keys detected at load time
Commit CommitConfig `yaml:"commit"`
}
AppConfig defines the global lazyworktree configuration options.
func DefaultConfig ¶
func DefaultConfig() *AppConfig
DefaultConfig returns the default configuration values.
func LoadConfig ¶
LoadConfig loads the application configuration from a file.
func (*AppConfig) ApplyCLIOverrides ¶ added in v1.24.0
ApplyCLIOverrides applies CLI config overrides to the configuration.
func (*AppConfig) IconsEnabled ¶ added in v1.27.0
IconsEnabled reports whether icon rendering should be enabled for the current icon set.
type CommitConfig ¶ added in v1.42.0
type CommitConfig struct {
AutoGenerateCommand string `yaml:"auto_generate_command"`
}
CommitConfig defines settings for commit operations.
type ContainerCommand ¶ added in v1.41.0
type ContainerCommand struct {
Image string // Required: container image (e.g. "golang:1.22")
Runtime string // Optional: "docker" or "podman" (auto-detected if empty)
Mounts []ContainerMount // Optional: additional bind mounts
Env map[string]string // Optional: extra environment variables
WorkingDir string // Optional: working directory inside container (default: /workspace)
ExtraArgs []string // Optional: extra docker/podman run arguments
Args []string // Optional: arguments passed after image (as CMD)
Interactive bool // Optional: allocate TTY for interactive use
}
ContainerCommand configures OCI container execution for a custom command.
type ContainerMount ¶ added in v1.41.0
type ContainerMount struct {
Source string // Host path (supports env var expansion)
Target string // Container path
ReadOnly bool // Mount as read-only
Options string // Extra mount options (e.g. "z", "Z", "shared")
}
ContainerMount represents a bind mount for a container.
type CustomCommand ¶ added in v1.1.0
type CustomCommand struct {
Command string
Description string
ShowHelp bool
Wait bool
ShowOutput bool
NewTab bool // Launch command in a new terminal tab (Kitty, etc.)
Tmux *TmuxCommand
Zellij *TmuxCommand
Container *ContainerCommand
}
CustomCommand represents a user-defined command binding.
type CustomCommandsConfig ¶ added in v1.43.0
type CustomCommandsConfig map[string]map[string]*CustomCommand
CustomCommandsConfig maps pane names to key→*CustomCommand maps. "universal" applies to all panes.
func (CustomCommandsConfig) AllForPane ¶ added in v1.43.0
func (c CustomCommandsConfig) AllForPane(paneName string) map[string]*CustomCommand
AllForPane returns a merged map of universal + pane-specific commands (pane wins on conflict).
func (CustomCommandsConfig) AllUniversal ¶ added in v1.43.0
func (c CustomCommandsConfig) AllUniversal() map[string]*CustomCommand
AllUniversal returns only the universal commands.
func (CustomCommandsConfig) Lookup ¶ added in v1.43.0
func (c CustomCommandsConfig) Lookup(paneName, key string) (*CustomCommand, bool)
Lookup returns the custom command for the given pane and key, checking pane-specific first, then universal.
type CustomCreateMenu ¶ added in v1.21.0
type CustomCreateMenu struct {
Label string // Display label in the menu
Description string // Help text shown next to label
Command string // Shell command that outputs branch name
Interactive bool // Run interactively (TUI suspends, captures stdout via temp file)
PostCommand string // Command to run after worktree creation (optional)
PostInteractive bool // Run post-command interactively (default: false)
}
CustomCreateMenu defines a custom entry in the worktree creation menu. The command should output a branch name that will be sanitized and used.
type CustomTheme ¶ added in v1.25.0
type CustomTheme struct {
Base string // Optional base theme name (built-in or custom)
Accent string
AccentFg string
AccentDim string
Border string
BorderDim string
MutedFg string
TextFg string
SuccessFg string
WarnFg string
ErrorFg string
Cyan string
}
CustomTheme represents a user-defined theme that can inherit from built-in or other custom themes.
func (*CustomTheme) ToThemeData ¶ added in v1.25.0
func (ct *CustomTheme) ToThemeData() *theme.CustomThemeData
ToThemeData converts CustomTheme to theme.CustomThemeData to avoid circular dependencies.
type KeybindingsConfig ¶ added in v1.43.0
KeybindingsConfig maps pane names to key→actionID maps. "universal" applies to all panes.
func (KeybindingsConfig) AllForPane ¶ added in v1.43.0
func (k KeybindingsConfig) AllForPane(paneName string) map[string]string
AllForPane returns a merged key→actionID map: universal bindings first, then pane-specific bindings override. Mirrors CustomCommandsConfig.AllForPane.
type LayoutSizes ¶ added in v1.40.0
type LayoutSizes struct {
Worktrees int // Main pane width (default layout) or height (top layout)
Info int // Info pane share of secondary area
GitStatus int // Git status pane share (when visible)
Commit int // Commit log pane share
Notes int // Notes pane share (when visible)
AgentSessions int // Agent sessions pane share (when visible)
}
LayoutSizes holds user-configurable pane size weights. Values are relative weights (1–100) that get normalised at computation time. A nil LayoutSizes means the hardcoded defaults are used.
type RepoConfig ¶
RepoConfig represents repository-scoped commands from .wt
func LoadRepoConfig ¶
func LoadRepoConfig(repoPath string) (*RepoConfig, string, error)
LoadRepoConfig loads the repository configuration from a .wt file.
type TmuxCommand ¶ added in v1.7.0
type TmuxCommand struct {
SessionName string
Attach bool
OnExists string
Windows []TmuxWindow
}
TmuxCommand represents a configured tmux session layout.
type TmuxWindow ¶ added in v1.7.0
TmuxWindow represents a tmux window configuration.