mode_legend_css.go RawHistoryFolder

1package theme
2
3import (
4	"fmt"
5	"strings"
6)
7
8// modeLegendColors maps legend mode classes to the palette variables of their mode.
9var modeLegendColors = []struct{ mode, color, text string }{
10	{"pane", "--pane-mode-color", "--pane-mode-text"},
11	{"vim", "--vim-mode-color", "--vim-mode-text"},
12	{"resize", "--resize-mode-color", "--resize-mode-text"},
13	{"tab", "--tab-mode-color", "--tab-mode-text"},
14	{"session", "--session-mode-color", "--session-mode-text"},
15	{"prefix", "--pane-mode-color", "--pane-mode-text"},
16}
17
18func generateModeLegendCSS() string {
19	var sb strings.Builder
20	sb.WriteString(`/* Mode frame legend: omnibox surface, tinted with the active mode color. */
21.mode-legend-anchor { background-color: transparent; }
22.omnibox-container.mode-legend-panel {
23	border-style: solid;
24	border-width: 0.125em;
25	padding: 0 0 0.375em 0;
26	min-width: 0;
27	animation: mode-legend-appear 120ms ease-out;
28}
29.omnibox-container.mode-legend-panel.mode-legend-lingering { opacity: 0.85; }
30.omnibox-container.mode-legend-panel.mode-legend-no-motion { animation: none; }
31.mode-legend-title {
32	font-family: var(--font-mono);
33	font-size: 0.8125em;
34	font-weight: bold;
35	padding: 0.375em 0.75em;
36	margin-bottom: 0.375em;
37}
38.mode-legend-content { padding: 0 0.25em; }
39.mode-legend-group { margin: 0 0.375em; min-width: 0; }
40.mode-legend-group-title {
41	font-family: var(--font-mono);
42	font-size: 0.6875em;
43	font-weight: bold;
44	margin-bottom: 0.25em;
45}
46.mode-legend-row { padding: 0.125em 0; min-width: 0; }
47.mode-legend-keycap {
48	font-family: var(--font-mono);
49	font-size: 0.75em;
50	font-weight: bold;
51	color: var(--control-text);
52	background-color: var(--surface-variant);
53	border-style: solid;
54	border-width: 0.0625em;
55	border-radius: 0.25em;
56	padding: 0.125em 0.375em;
57	margin-right: 0.375em;
58	transition: background-color 120ms ease-out, color 120ms ease-out;
59}
60.mode-legend-description { font-size: 0.75em; color: var(--surface-muted); }
61.mode-legend-row.mode-legend-dim { opacity: 0.3; }
62@keyframes mode-legend-appear {
63	from { opacity: 0; }
64	to { opacity: 1; }
65}
66`)
67	for _, m := range modeLegendColors {
68		fmt.Fprintf(&sb, `.omnibox-container.mode-legend-panel.mode-legend-%[1]s { border-color: var(%[2]s); }
69.mode-legend-%[1]s .mode-legend-title { background-color: var(%[2]s); color: var(%[3]s); }
70.mode-legend-%[1]s .mode-legend-group-title { color: var(%[2]s); }
71.mode-legend-%[1]s .mode-legend-keycap { border-color: alpha(var(%[2]s), 0.6); }
72.mode-legend-%[1]s .mode-legend-keycap.mode-legend-flash { background-color: var(%[2]s); color: var(%[3]s); }
73`, m.mode, m.color, m.text)
74	}
75	return sb.String()
76}

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