1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#[derive(Debug, Clone, PartialEq)]
pub enum Mode {
/// Non-modal text editing: typing inserts, chords/prefixes run commands.
Edit,
/// Mission control (Ctrl+Space / M-x) — fuzzy actions + Ask agent + `!` shell.
Bar,
/// Minibuffer prompt (find-file, switch-buffer, save-as, isearch, confirms).
Prompt,
/// C-t travel mode: one-char tab/pane verbs with an on-screen cheat panel.
Tab,
/// Focused terminal pane owns the keyboard.
Terminal,
/// Left file-tree sidebar owns the keyboard (browse + type-to-filter).
Tree,
/// Undo time-travel: ←/→ step backward/forward through edit history.
Undo,
}
impl Mode {
pub fn label(&self) -> &'static str {
match self {
Mode::Edit => "EDIT",
Mode::Bar => "MC", // mission control
Mode::Prompt => "MINI",
Mode::Tab => "WARP",
Mode::Terminal => "TERM",
Mode::Tree => "NAV",
Mode::Undo => "TIME",
}
}
/// Short hint pairs (key, action) shown in the status bar.
/// Edit-mode hints are derived live from the keymap in `ui::render_status`
/// (so they stay honest after a remap) — hence the empty slice here.
pub fn hints(&self) -> &'static [(&'static str, &'static str)] {
match self {
Mode::Edit => &[],
Mode::Bar => &[
("Tab", "cmd/ask"),
("!", "shell"),
("?", "ask"),
("↑↓", "move/scroll"),
("⏎", "run"),
("C-l", "new chat"),
("Esc", "close"),
],
Mode::Prompt => &[
("⏎", "accept"),
("C-g", "cancel"),
],
Mode::Tab => &[
("t", "new tab"),
("←→", "switch"),
("1-9", "jump"),
("|/-", "split"),
("o", "pane"),
("Esc", "done"),
],
// NOTE: the status bar renders Terminal hints live (ui::status_hints)
// so the bar-open chord stays honest; this static copy is a fallback.
// "to editor" (not "detach") — C-g leaves the pane; session detach is
// C-x C-d.
Mode::Terminal => &[
("C-g", "to editor"),
("C-Spc", "commands"),
("type", "to shell"),
],
Mode::Tree => &[
("↑↓", "move"),
("→", "expand/preview"),
("⏎", "open"),
("←", "collapse"),
("type", "filter"),
("Esc", "close"),
],
Mode::Undo => &[
("←", "undo"),
("→", "redo"),
("Home", "undo all"),
("End", "redo all"),
("Esc", "done"),
],
}
}
}