v0.1 bf7c821

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    }
65}
66
67// GetDefaultSearchShortcuts returns the default search shortcuts.
68func GetDefaultSearchShortcuts() map[string]SearchShortcut {
69	return map[string]SearchShortcut{
70		"g": {
71			URL:         "https://www.google.com/search?q=%s",
72			Description: "Google search",
73		},
74		"gh": {
75			URL:         "https://github.com/search?q=%s",
76			Description: "GitHub search",
77		},
78		"yt": {
79			URL:         "https://www.youtube.com/results?search_query=%s",
80			Description: "YouTube search",
81		},
82		"w": {
83			URL:         "https://en.wikipedia.org/wiki/%s",
84			Description: "Wikipedia search",
85		},
86		"ddg": {
87			URL:         "https://duckduckgo.com/?q=%s",
88			Description: "DuckDuckGo search",
89		},
90		"so": {
91			URL:         "https://stackoverflow.com/search?q=%s",
92			Description: "Stack Overflow search",
93		},
94		"r": {
95			URL:         "https://www.reddit.com/search?q=%s",
96			Description: "Reddit search",
97		},
98		"npm": {
99			URL:         "https://www.npmjs.com/search?q=%s",
100			Description: "npm package search",
101		},
102		"go": {
103			URL:         "https://pkg.go.dev/search?q=%s",
104			Description: "Go package search",
105		},
106		"mdn": {
107			URL:         "https://developer.mozilla.org/en-US/search?q=%s",
108			Description: "MDN Web Docs search",
109		},
110	}
111}
112
113// 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