v0.4.0 6203a22

defaults.go RawHistoryFolder

1// Package config provides default configuration values for dumber.
2package config
3
4import (
5	"time"
6)
7
8// DefaultConfig returns the default configuration values for dumber.
9func DefaultConfig() *Config {
10	return &Config{
11		Database: DatabaseConfig{
12			MaxConnections: 1,
13			MaxIdleTime:    time.Minute * 5,
14			QueryTimeout:   time.Second * 30,
15		},
16		History: HistoryConfig{
17			MaxEntries:          10000,
18			RetentionPeriodDays: 365, // 1 year
19			CleanupIntervalDays: 1,   // daily cleanup
20		},
21		SearchShortcuts: map[string]SearchShortcut{
22			"g": {
23				URL:         "https://www.google.com/search?q=%s",
24				Description: "Google search",
25			},
26			"gh": {
27				URL:         "https://github.com/search?q=%s",
28				Description: "GitHub search",
29			},
30			"yt": {
31				URL:         "https://www.youtube.com/results?search_query=%s",
32				Description: "YouTube search",
33			},
34			"w": {
35				URL:         "https://en.wikipedia.org/wiki/%s",
36				Description: "Wikipedia search",
37			},
38		},
39		Dmenu: DmenuConfig{
40			MaxHistoryItems:  20,
41			ShowVisitCount:   true,
42			ShowLastVisited:  true,
43			HistoryPrefix:    "🕒",
44			ShortcutPrefix:   "🔍",
45			URLPrefix:        "🌐",
46			DateFormat:       "2006-01-02 15:04",
47			SortByVisitCount: true,
48		},
49		Logging: LoggingConfig{
50			Level:      "info",
51			Format:     "text", // text or json
52			Filename:   "",     // empty means stdout
53			MaxSize:    100,    // MB
54			MaxBackups: 3,
55			MaxAge:     7, // days
56			Compress:   true,
57		},
58		Appearance: AppearanceConfig{
59			SansFont:        "Fira Sans",
60			SerifFont:       "Fira Sans",
61			MonospaceFont:   "Fira Code",
62			DefaultFontSize: 16,
63		},
64		RenderingMode: RenderingModeAuto,
65	}
66}
67
68// GetDefaultSearchShortcuts returns the default search shortcuts.
69func GetDefaultSearchShortcuts() map[string]SearchShortcut {
70	return map[string]SearchShortcut{
71		"g": {
72			URL:         "https://www.google.com/search?q=%s",
73			Description: "Google search",
74		},
75		"gh": {
76			URL:         "https://github.com/search?q=%s",
77			Description: "GitHub search",
78		},
79		"yt": {
80			URL:         "https://www.youtube.com/results?search_query=%s",
81			Description: "YouTube search",
82		},
83		"w": {
84			URL:         "https://en.wikipedia.org/wiki/%s",
85			Description: "Wikipedia search",
86		},
87		"ddg": {
88			URL:         "https://duckduckgo.com/?q=%s",
89			Description: "DuckDuckGo search",
90		},
91		"so": {
92			URL:         "https://stackoverflow.com/search?q=%s",
93			Description: "Stack Overflow search",
94		},
95		"r": {
96			URL:         "https://www.reddit.com/search?q=%s",
97			Description: "Reddit search",
98		},
99		"npm": {
100			URL:         "https://www.npmjs.com/search?q=%s",
101			Description: "npm package search",
102		},
103		"go": {
104			URL:         "https://pkg.go.dev/search?q=%s",
105			Description: "Go package search",
106		},
107		"mdn": {
108			URL:         "https://developer.mozilla.org/en-US/search?q=%s",
109			Description: "MDN Web Docs search",
110		},
111	}
112}
113
114// Note: We build our own browser, so no external browser commands needed

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 8

Tags 42

↑↓ moveenter openesc close