config.go RawHistoryFolder

1package domain
2
3import (
4	"time"
5
6	"github.com/bnema/vev/internal/domain/terminalcap"
7)
8
9// MinBarInterval is the minimum supported bar refresh interval.
10const MinBarInterval = time.Second
11
12// DefaultWordSeparators matches tmux's practical shell-oriented word boundaries.
13const DefaultWordSeparators = " -_@"
14
15// ThemeMode selects how vev derives its color scheme.
16type ThemeMode int
17
18const (
19	// ThemeAuto follows the attached client's reported color scheme.
20	ThemeAuto ThemeMode = iota
21	// ThemeDark forces vev's built-in dark palette.
22	ThemeDark
23	// ThemeLight forces vev's built-in light palette.
24	ThemeLight
25)
26
27// ConfigEntry preserves one parsed config key/value in file order.
28type ConfigEntry struct {
29	Key   string
30	Value string
31}
32
33// SnapshotConfig contains user-configurable snapshot restore settings.
34type SnapshotConfig struct {
35	RestoreProcesses    []string
36	RestoreProcessesSet bool
37}
38
39// defaultSnapshotRestoreProcesses is the default allowlist for process restore.
40var defaultSnapshotRestoreProcesses = []string{
41	"vi", "vim", "nvim", "emacs", "man", "less", "more", "tail", "top", "htop", "btop",
42	"claude", "codex", "pi", "opencode",
43}
44
45// DefaultSnapshotRestoreProcesses returns a copy of the default process restore allowlist.
46func DefaultSnapshotRestoreProcesses() []string {
47	return append([]string(nil), defaultSnapshotRestoreProcesses...)
48}
49
50// BarConfig contains user-configurable bar right-anchor settings.
51type BarConfig struct {
52	TopRight    string
53	BottomRight string
54	Interval    time.Duration
55}
56
57// CopyConfig contains copy-mode selection and mouse motion settings.
58type CopyConfig struct {
59	WordSeparators string
60	ReduceMotion   bool
61}
62
63// PaletteConfig contains palette placement settings. A false AnchorSet uses the
64// adaptive automatic placement.
65type PaletteConfig struct {
66	Anchor    Anchor
67	AnchorSet bool
68}
69
70// FloatingConfig contains launch and sizing settings for per-tab floating panes.
71type FloatingConfig struct {
72	Command string
73	Width   int
74	Height  int
75}
76
77// NavConfig contains directional navigation overflow settings.
78type NavConfig struct {
79	OverflowTabs     bool
80	OverflowSessions bool
81}
82
83// TabsConfig contains tab label display settings.
84type TabsConfig struct {
85	// TerminalTitle includes the focused pane's OSC terminal title in tab
86	// labels (top bar and session picker). The process name always shows.
87	TerminalTitle bool
88}
89
90// EphemeralConfig contains numbered-session lifetime settings.
91type EphemeralConfig struct {
92	// CloseOnExit removes an ephemeral session once its last attachment ends
93	// definitively: a closed client process (Detach{Closed}), or an expired
94	// park or suspension. A user detach keeps it.
95	CloseOnExit bool
96}
97
98// KeyboardConfig contains outer-terminal keyboard settings.
99type KeyboardConfig struct {
100	// KittyProtocol enables the kitty keyboard protocol on outer terminals
101	// that support it, which makes Ctrl+1..9 recent-session switching work.
102	KittyProtocol bool
103}
104
105// EchoPredictMode selects when a remote attachment shows predicted local echo.
106type EchoPredictMode uint8
107
108const (
109	// EchoPredictNever disables prediction. It is the zero value, so a
110	// client composed without the user's config (virtual terminals, UI
111	// drivers) never predicts.
112	EchoPredictNever EchoPredictMode = iota
113	// EchoPredictAdaptive shows predictions only on a slow or glitchy link.
114	EchoPredictAdaptive
115	// EchoPredictAlways shows predictions whatever the link latency.
116	EchoPredictAlways
117)
118
119// EchoConfig contains client-side predictive echo settings.
120type EchoConfig struct {
121	// Predict selects when remote attachments draw typed characters before
122	// the daemon echoes them.
123	Predict EchoPredictMode
124}
125
126// TerminalConfig contains client-side outer-terminal settings. It is read by
127// each client at startup and never applied by the daemon, so a change takes
128// effect on the next client process.
129type TerminalConfig struct {
130	// Colors is the forced color mode when ColorsSet is true. A false
131	// ColorsSet (terminal.colors = auto, the default) uses detection.
132	Colors    terminalcap.ColorMode
133	ColorsSet bool
134}
135
136// ScrollbackConfig is vev's per-pane retention policy. The terminal library
137// only enforces these application-selected limits. Zero megabytes disables
138// history; zero lines removes the additional line ceiling.
139type ScrollbackConfig struct {
140	Megabytes uint64
141	Lines     int
142}
143
144const DefaultScrollbackMegabytes uint64 = 50
145const DefaultScrollbackLines = 10_000
146const MaxScrollbackMegabytes uint64 = 4096
147const MaxScrollbackLines = 1_000_000
148
149func DefaultScrollbackConfig() ScrollbackConfig {
150	return ScrollbackConfig{Megabytes: DefaultScrollbackMegabytes, Lines: DefaultScrollbackLines}
151}
152
153func (c ScrollbackConfig) Valid() bool {
154	return c.Megabytes <= MaxScrollbackMegabytes && c.Lines >= 0 && c.Lines <= MaxScrollbackLines
155}
156
157// Config is the user-editable vev configuration after parsing. Unknown binding
158// keys are preserved here (in BindingEntries, in file order) so the usecase
159// layer can decide which actions it understands.
160type Config struct {
161	WebListen      string
162	WebOrigin      string
163	Theme          ThemeMode
164	ThemePalette   bool
165	ThemeAccent    ThemeAccent
166	Bar            BarConfig
167	BindingEntries []ConfigEntry
168	Codes          map[string]string
169	Snapshot       SnapshotConfig
170	Copy           CopyConfig
171	Palette        PaletteConfig
172	Floating       FloatingConfig
173	Nav            NavConfig
174	Tabs           TabsConfig
175	Ephemeral      EphemeralConfig
176	Keyboard       KeyboardConfig
177	Echo           EchoConfig
178	Terminal       TerminalConfig
179	Scrollback     ScrollbackConfig
180}
181
182// Warning describes a non-fatal config problem. Parsers and reloaders should
183// warn and continue with defaults rather than aborting startup.
184type Warning struct {
185	Line int
186	Msg  string
187}
188
189// Defaults returns vev's default configuration.
190func Defaults() Config {
191	return Config{
192		Theme:        ThemeAuto,
193		ThemePalette: true,
194		ThemeAccent:  ThemeAccent{Mode: ThemeAccentAuto},
195		Bar: BarConfig{
196			Interval: 5 * time.Second,
197		},
198		BindingEntries: []ConfigEntry{},
199		Codes:          map[string]string{},
200		Snapshot: SnapshotConfig{
201			RestoreProcesses: DefaultSnapshotRestoreProcesses(),
202		},
203		Copy: CopyConfig{
204			WordSeparators: DefaultWordSeparators,
205		},
206		Palette: PaletteConfig{
207			Anchor:    AnchorCenter,
208			AnchorSet: true,
209		},
210		Floating: FloatingConfig{
211			Width:  80,
212			Height: 80,
213		},
214		Tabs: TabsConfig{
215			TerminalTitle: true,
216		},
217		Ephemeral: EphemeralConfig{
218			CloseOnExit: true,
219		},
220		Keyboard: KeyboardConfig{
221			KittyProtocol: true,
222		},
223		Echo: EchoConfig{
224			Predict: EchoPredictAdaptive,
225		},
226		Scrollback: DefaultScrollbackConfig(),
227	}
228}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close