keybindings.go RawHistoryFolder

1package port
2
3import "context"
4
5// KeybindingEntry represents a single keybinding for the UI.
6type KeybindingEntry struct {
7	Action      string   `json:"action"`
8	Description string   `json:"description"`
9	Keys        []string `json:"keys"`
10	DefaultKeys []string `json:"default_keys"`
11	IsCustom    bool     `json:"is_custom"`
12}
13
14// KeybindingGroup represents keybindings for a mode.
15type KeybindingGroup struct {
16	Mode        string            `json:"mode"`
17	DisplayName string            `json:"display_name"`
18	Bindings    []KeybindingEntry `json:"bindings"`
19	Activation  string            `json:"activation,omitempty"`
20}
21
22// KeybindingsConfig represents all keybindings for the UI.
23type KeybindingsConfig struct {
24	Groups []KeybindingGroup `json:"groups"`
25}
26
27// SetKeybindingRequest represents a request to update a keybinding.
28type SetKeybindingRequest struct {
29	RequestID string   `json:"requestId"`
30	Mode      string   `json:"mode"`
31	Action    string   `json:"action"`
32	Keys      []string `json:"keys"`
33}
34
35// ResetKeybindingRequest represents a request to reset a keybinding.
36type ResetKeybindingRequest struct {
37	RequestID string `json:"requestId"`
38	Mode      string `json:"mode"`
39	Action    string `json:"action"`
40}
41
42// KeybindingConflict represents a detected conflict.
43type KeybindingConflict struct {
44	ConflictingAction string `json:"conflicting_action"`
45	ConflictingMode   string `json:"conflicting_mode"`
46	Key               string `json:"key"`
47}
48
49// SetKeybindingResponse is the response from setting a keybinding.
50type SetKeybindingResponse struct {
51	Conflicts []KeybindingConflict `json:"conflicts"`
52}
53
54// KeybindingsProvider provides keybinding configuration data.
55type KeybindingsProvider interface {
56	GetKeybindings(ctx context.Context) (KeybindingsConfig, error)
57	GetDefaultKeybindings(ctx context.Context) (KeybindingsConfig, error)
58	CheckConflicts(ctx context.Context, mode, action string, keys []string) ([]KeybindingConflict, error)
59}
60
61// KeybindingsSaver persists keybinding changes.
62type KeybindingsSaver interface {
63	SetKeybinding(ctx context.Context, req SetKeybindingRequest) error
64	ResetKeybinding(ctx context.Context, req ResetKeybindingRequest) error
65	ResetAllKeybindings(ctx context.Context) error
66}
67
68// KeybindingsGetter retrieves all keybindings (narrow interface for the handler).
69type KeybindingsGetter interface {
70	Execute(ctx context.Context) (KeybindingsConfig, error)
71}
72
73// KeybindingSetter updates a single keybinding (narrow interface for the handler).
74type KeybindingSetter interface {
75	Execute(ctx context.Context, req SetKeybindingRequest) (SetKeybindingResponse, error)
76}
77
78// KeybindingResetter resets a single keybinding to default (narrow interface for the handler).
79type KeybindingResetter interface {
80	Execute(ctx context.Context, req ResetKeybindingRequest) error
81}
82
83// AllKeybindingsResetter resets all keybindings to defaults (narrow interface for the handler).
84type AllKeybindingsResetter interface {
85	Execute(ctx context.Context) error
86}

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