v0.0.15 3ff6d9e

help.go RawHistoryFolder

1package modes
2
3import (
4	"fmt"
5	"strings"
6
7	"github.com/patriceckhart/zot/internal/tui"
8)
9
10// helpKeyRows is the list of keybindings shown by /help.
11var helpKeyRows = [][2]string{
12	{"enter", "submit the current input"},
13	{"alt+enter", "insert a newline"},
14	{"tab", "complete the highlighted slash command"},
15	{"esc", "cancel the current turn (while busy) · clear the input (while idle)"},
16	{"ctrl+c", "exit (while idle) · cancel the current turn (while busy)"},
17	{"ctrl+w", "delete previous word"},
18	{"alt+backspace", "delete previous word (same as ctrl+w)"},
19	{"ctrl+u / ctrl+k", "delete to start / end of line"},
20	{"ctrl+a / ctrl+e", "jump to start / end of line"},
21	{"alt+← / alt+→", "jump one word back / forward"},
22	{"ctrl+l", "redraw the screen"},
23	{"ctrl+o", "expand / collapse long tool results"},
24	{"pgup / pgdn", "scroll the chat one page up / down"},
25	{"up / down", "scroll by 3 lines (when input is empty) · prompt history (otherwise)"},
26}
27
28// renderHelpBlock builds the friendly /help view. Uses the shared
29// frameHeader/frameRule helpers so the rules match every other block
30// in the tui (tool results, code fences, dialogs) — full terminal width
31// in the muted colour.
32func renderHelpBlock(th tui.Theme, width int) []string {
33	if width < 20 {
34		width = 20
35	}
36	var out []string
37	out = append(out, frameHeader(th, "zot help", width))
38
39	// commands section
40	out = append(out, tui.Bold("slash commands:"))
41	for _, c := range slashCatalog {
42		name := c.Name
43		if len(name) < 10 {
44			name = name + strings.Repeat(" ", 10-len(name))
45		}
46		out = append(out, fmt.Sprintf("  %s  %s",
47			th.FG256(th.Accent, name),
48			th.FG256(th.Muted, c.Desc)))
49	}
50
51	// keys section
52	out = append(out, "", tui.Bold("keys:"))
53	for _, k := range helpKeyRows {
54		name := k[0]
55		if len(name) < 14 {
56			name = name + strings.Repeat(" ", 14-len(name))
57		}
58		out = append(out, fmt.Sprintf("  %s  %s",
59			th.FG256(th.Accent, name),
60			th.FG256(th.Muted, k[1])))
61	}
62
63	out = append(out, frameRule(th, width), "")
64	return out
65}

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 1

Tags 476

↑↓ moveenter openesc close