v0.50.0 c4ec31f

help.go RawHistoryFolder

1package modes
2
3import (
4	"fmt"
5	"strings"
6
7	"github.com/bnema/zut/packages/tui"
8	"github.com/mattn/go-runewidth"
9)
10
11// helpKeyRows is the list of keybindings shown by /help.
12var helpKeyRows = [][2]string{
13	{"enter", "submit the current input"},
14	{"shift+enter / alt+enter", "insert a newline"},
15	{"tab", "complete the highlighted slash command; next model profile when idle"},
16	{"shift+tab", "previous model profile"},
17	{"esc", "cancel the current turn (while busy) - clear idle input; two bare Esc presses within 500ms open /session tree"},
18	{"ctrl+c", "exit (while idle) - cancel the current turn (while busy)"},
19	{"ctrl+w", "delete previous word"},
20	{"alt+backspace", "delete previous word (same as ctrl+w)"},
21	{"ctrl+u / ctrl+k", "delete to start / end of line"},
22	{"ctrl+a / ctrl+e", "jump to start / end of line"},
23	{"alt+← / alt+→", "jump one word back / forward"},
24	{"ctrl+l", "redraw the screen"},
25	{"ctrl+o", "expand / collapse long tool results"},
26	{"ctrl+r", "cycle reasoning levels for the active model"},
27	{"ctrl+1…9", "activate model + reasoning + fast-mode profile (AZERTY top row also works); empty slots open the model picker"},
28	{"pgup / pgdn", "scroll the chat one page up / down"},
29	{"up / down", "move in input, browse prompt history at top edge, scroll chat when empty"},
30}
31
32// renderHelpBlock builds the friendly /help view. Uses the shared
33// frameHeader/frameRule helpers so the rules match every other block
34// in the tui (tool results, code fences, dialogs) — full terminal width
35// in the muted colour.
36//
37// Slash commands and keybindings share the same label column width so
38// every description starts at the same x-position, regardless of which
39// section it lives in. The width is computed from the longest label
40// across BOTH lists, with a minimum of 14 cells so changes to either
41// list don't compress the column visually.
42func renderHelpBlock(th tui.Theme, width int, llamaConfigured bool) []string {
43	if width < 20 {
44		width = 20
45	}
46
47	// Label column width uses display cells, not byte length, so
48	// single-cell multibyte runes (← → - ...) don't over-count and leave
49	// a raggedy right edge. `len("alt+← / alt+→")` is 17 bytes but
50	// only 13 cells; padding off byte length would either overshoot
51	// (setting labelWidth too high and wasting space on every row)
52	// or undershoot (never padding that row because len >= labelWidth
53	// already, leaving its description mis-aligned).
54	labelWidth := 14
55	for _, c := range slashCatalog {
56		if c.Name == "/llama" && !llamaConfigured {
57			continue
58		}
59		if n := runewidth.StringWidth(c.Name); n > labelWidth {
60			labelWidth = n
61		}
62	}
63	for _, k := range helpKeyRows {
64		if n := runewidth.StringWidth(k[0]); n > labelWidth {
65			labelWidth = n
66		}
67	}
68
69	pad := func(s string) string {
70		w := runewidth.StringWidth(s)
71		if w >= labelWidth {
72			return s
73		}
74		return s + strings.Repeat(" ", labelWidth-w)
75	}
76
77	var out []string
78	out = append(out, frameHeader(th, "zut help", width), "")
79
80	// commands section
81	out = append(out, tui.Bold("slash commands:"))
82	for _, c := range slashCatalog {
83		if c.Name == "/llama" && !llamaConfigured {
84			continue
85		}
86		out = append(out, fmt.Sprintf("  %s  %s",
87			th.FGColor(th.Accent, pad(c.Name)),
88			th.FGColor(th.Muted, c.Desc)))
89	}
90
91	// keys section
92	out = append(out, "", tui.Bold("keys:"))
93	for _, k := range helpKeyRows {
94		out = append(out, fmt.Sprintf("  %s  %s",
95			th.FGColor(th.Accent, pad(k[0])),
96			th.FGColor(th.Muted, k[1])))
97	}
98
99	out = append(out, "", frameRule(th, width), "")
100	return out
101}

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 477

↑↓ moveenter openesc close