1use super::{HelpCategory, HelpEntry};
2
3pub static NORMAL_ENTRIES: &[HelpEntry] = &[
4 HelpEntry {
5 tags: &["h"],
6 category: HelpCategory::Normal,
7 summary: "Move cursor left",
8 detail: "Move the cursor one column to the left. Stops at column A.\nAlias: Left arrow",
9 },
10 HelpEntry {
11 tags: &["j"],
12 category: HelpCategory::Normal,
13 summary: "Move cursor down",
14 detail: "Move the cursor one row down.\nAlias: Down arrow",
15 },
16 HelpEntry {
17 tags: &["k"],
18 category: HelpCategory::Normal,
19 summary: "Move cursor up",
20 detail: "Move the cursor one row up. Stops at row 1.\nAlias: Up arrow",
21 },
22 HelpEntry {
23 tags: &["l"],
24 category: HelpCategory::Normal,
25 summary: "Move cursor right",
26 detail: "Move the cursor one column to the right.\nAlias: Right arrow",
27 },
28 HelpEntry {
29 tags: &["gg"],
30 category: HelpCategory::Normal,
31 summary: "Go to first row",
32 detail: "Move the cursor to row 1, keeping the current column.",
33 },
34 HelpEntry {
35 tags: &["G"],
36 category: HelpCategory::Normal,
37 summary: "Go to last row",
38 detail: "Move the cursor to the last row with data, keeping the current column.",
39 },
40 HelpEntry {
41 tags: &["0"],
42 category: HelpCategory::Normal,
43 summary: "Go to first column",
44 detail: "Move the cursor to column A, keeping the current row.",
45 },
46 HelpEntry {
47 tags: &["$"],
48 category: HelpCategory::Normal,
49 summary: "Go to last column",
50 detail: "Move the cursor to the last column with data, keeping the current row.",
51 },
52 HelpEntry {
53 tags: &["w"],
54 category: HelpCategory::Normal,
55 summary: "Next non-empty cell",
56 detail: "Jump to the next non-empty cell to the right in the current row.",
57 },
58 HelpEntry {
59 tags: &["b"],
60 category: HelpCategory::Normal,
61 summary: "Previous non-empty cell",
62 detail: "Jump to the previous non-empty cell to the left in the current row.",
63 },
64 HelpEntry {
65 tags: &["dd"],
66 category: HelpCategory::Normal,
67 summary: "Delete current row",
68 detail: "Deletes all cells in the current row. The row contents are stored\nin the register and can be pasted with p or P. Undoable with u.",
69 },
70 HelpEntry {
71 tags: &["yy"],
72 category: HelpCategory::Normal,
73 summary: "Yank current row",
74 detail: "Copies all cells in the current row to the register.\nPaste with p (below) or P (above).",
75 },
76 HelpEntry {
77 tags: &["x"],
78 category: HelpCategory::Normal,
79 summary: "Clear current cell",
80 detail: "Clears the content of the cell under the cursor. Undoable with u.",
81 },
82 HelpEntry {
83 tags: &["p"],
84 category: HelpCategory::Normal,
85 summary: "Paste below",
86 detail: "Paste the register contents below the current row (for row/block\nregisters) or into the cell below (for cell registers).\nFormula references are adjusted automatically.",
87 },
88 HelpEntry {
89 tags: &["P"],
90 category: HelpCategory::Normal,
91 summary: "Paste above",
92 detail: "Paste the register contents above the current row (for row/block\nregisters) or into the current cell (for cell registers).\nFormula references are adjusted automatically.",
93 },
94 HelpEntry {
95 tags: &["u"],
96 category: HelpCategory::Normal,
97 summary: "Undo",
98 detail: "Undo the last cell edit. Supports multiple levels of undo.",
99 },
100 HelpEntry {
101 tags: &["Ctrl+R"],
102 category: HelpCategory::Normal,
103 summary: "Redo",
104 detail: "Redo the last undone edit.",
105 },
106 HelpEntry {
107 tags: &["Ctrl+D"],
108 category: HelpCategory::Normal,
109 summary: "Half page down",
110 detail: "Move the cursor down by half the visible page height.",
111 },
112 HelpEntry {
113 tags: &["Ctrl+U"],
114 category: HelpCategory::Normal,
115 summary: "Half page up",
116 detail: "Move the cursor up by half the visible page height.",
117 },
118 HelpEntry {
119 tags: &["Ctrl+F"],
120 category: HelpCategory::Normal,
121 summary: "Page down",
122 detail: "Move the cursor down by one full page.",
123 },
124 HelpEntry {
125 tags: &["Ctrl+B"],
126 category: HelpCategory::Normal,
127 summary: "Page up",
128 detail: "Move the cursor up by one full page.",
129 },
130 HelpEntry {
131 tags: &["i", "a"],
132 category: HelpCategory::Normal,
133 summary: "Enter Insert mode",
134 detail: "Switch to Insert mode to edit the current cell.\ni places the cursor at the end of existing content.\na behaves the same as i in Cell.",
135 },
136 HelpEntry {
137 tags: &["o"],
138 category: HelpCategory::Normal,
139 summary: "Enter Insert mode (new line)",
140 detail: "Switch to Insert mode. In Cell, behaves the same as i\n(there are no multi-line cells).",
141 },
142 HelpEntry {
143 tags: &["Enter"],
144 category: HelpCategory::Normal,
145 summary: "Edit cell",
146 detail: "Enter Insert mode to edit the current cell. Same as i.",
147 },
148 HelpEntry {
149 tags: &["v"],
150 category: HelpCategory::Normal,
151 summary: "Enter Visual mode",
152 detail: "Start visual selection from the current cell. Use h/j/k/l to\nextend the selection. Press d to delete or y to yank.",
153 },
154 HelpEntry {
155 tags: &["Ctrl+V"],
156 category: HelpCategory::Normal,
157 summary: "Enter Visual Block mode",
158 detail: "Start block (rectangular) selection from the current cell.\nUse h/j/k/l to extend. Press d to delete or y to yank.",
159 },
160 HelpEntry {
161 tags: &["/"],
162 category: HelpCategory::Normal,
163 summary: "Search forward",
164 detail: "Open the forward-search prompt. Type a pattern and press Enter to\nfind the next cell whose value contains the pattern.\nCase-insensitive. Use n / N to step through matches.",
165 },
166 HelpEntry {
167 tags: &["?"],
168 category: HelpCategory::Normal,
169 summary: "Search backward",
170 detail: "Open the backward-search prompt. Type a pattern and press Enter\nto find the previous cell whose value contains the pattern.\nCase-insensitive. Use n / N to step through matches.",
171 },
172 HelpEntry {
173 tags: &["n"],
174 category: HelpCategory::Normal,
175 summary: "Next search match",
176 detail: "Jump to the next cell matching the last search pattern.",
177 },
178 HelpEntry {
179 tags: &["N"],
180 category: HelpCategory::Normal,
181 summary: "Previous search match",
182 detail: "Jump to the previous cell matching the last search pattern.",
183 },
184 HelpEntry {
185 tags: &["f"],
186 category: HelpCategory::Normal,
187 summary: "Find char in row (forward)",
188 detail: "After f, the next keypress is the target character. The cursor\njumps to the next non-empty cell in the current row whose displayed\nvalue starts with that character (case-insensitive).\nUse ; to repeat and , to repeat reversed.",
189 },
190 HelpEntry {
191 tags: &["F"],
192 category: HelpCategory::Normal,
193 summary: "Find char in row (backward)",
194 detail: "Like f, but searches the current row to the left of the cursor.",
195 },
196 HelpEntry {
197 tags: &[";"],
198 category: HelpCategory::Normal,
199 summary: "Repeat last find",
200 detail: "Repeat the last f / F find in the same direction.",
201 },
202 HelpEntry {
203 tags: &[","],
204 category: HelpCategory::Normal,
205 summary: "Repeat last find reversed",
206 detail: "Repeat the last f / F find in the opposite direction.",
207 },
208];
209
210pub static INSERT_ENTRIES: &[HelpEntry] = &[
211 HelpEntry {
212 tags: &["Esc"],
213 category: HelpCategory::Insert,
214 summary: "Confirm edit, return to Normal",
215 detail: "Saves the current cell content and returns to Normal mode.",
216 },
217 HelpEntry {
218 tags: &["Enter-insert"],
219 category: HelpCategory::Insert,
220 summary: "Confirm edit and move down",
221 detail: "Saves the current cell content and returns to Normal mode.\nIn Insert mode, Enter confirms the edit (same as Esc).",
222 },
223 HelpEntry {
224 tags: &["Backspace"],
225 category: HelpCategory::Insert,
226 summary: "Delete character before cursor",
227 detail: "Deletes the character to the left of the cursor in the cell\nedit buffer.",
228 },
229 HelpEntry {
230 tags: &["Delete"],
231 category: HelpCategory::Insert,
232 summary: "Delete character at cursor",
233 detail: "Deletes the character at the cursor position in the cell\nedit buffer.",
234 },
235 HelpEntry {
236 tags: &["Left-insert", "Right-insert"],
237 category: HelpCategory::Insert,
238 summary: "Move cursor within cell",
239 detail: "Arrow keys move the cursor left/right within the cell edit\nbuffer during Insert mode.",
240 },
241 HelpEntry {
242 tags: &["Home"],
243 category: HelpCategory::Insert,
244 summary: "Move to start of cell",
245 detail: "Move the cursor to the beginning of the cell edit buffer.",
246 },
247 HelpEntry {
248 tags: &["End"],
249 category: HelpCategory::Insert,
250 summary: "Move to end of cell",
251 detail: "Move the cursor to the end of the cell edit buffer.",
252 },
253];
254
255pub static VISUAL_ENTRIES: &[HelpEntry] = &[
256 HelpEntry {
257 tags: &["v-visual"],
258 category: HelpCategory::Visual,
259 summary: "Enter Visual mode",
260 detail: "Start visual selection from Normal mode. The anchor is set at\nthe current cursor position.",
261 },
262 HelpEntry {
263 tags: &["Ctrl+V-visual"],
264 category: HelpCategory::Visual,
265 summary: "Enter Visual Block mode",
266 detail: "Start rectangular block selection from Normal mode.",
267 },
268 HelpEntry {
269 tags: &["d-visual"],
270 category: HelpCategory::Visual,
271 summary: "Delete selection",
272 detail: "Clear all cells in the visual selection. The contents are\nstored in the register. Returns to Normal mode.",
273 },
274 HelpEntry {
275 tags: &["y-visual"],
276 category: HelpCategory::Visual,
277 summary: "Yank selection",
278 detail: "Copy all cells in the visual selection to the register.\nReturns to Normal mode.",
279 },
280 HelpEntry {
281 tags: &["Esc-visual"],
282 category: HelpCategory::Visual,
283 summary: "Cancel selection",
284 detail: "Exit Visual mode and return to Normal mode without\nmodifying any cells.",
285 },
286];
287
288pub static COMMAND_ENTRIES: &[HelpEntry] = &[
289 HelpEntry {
290 tags: &[":w", ":write"],
291 category: HelpCategory::Command,
292 summary: "Save file",
293 detail: "Write the current sheet to disk. If no filename has been set,\nuse :w <path> to specify one.\n\nIf the sheet contains formulas and you save as CSV/TSV,\nCell will warn you. Use :w file.cell to preserve formulas,\nor :w! to force save as CSV (formulas become values).",
294 },
295 HelpEntry {
296 tags: &[":w!"],
297 category: HelpCategory::Command,
298 summary: "Force save",
299 detail: "Write the current sheet to disk, even if formulas would be\nlost by saving as CSV/TSV.",
300 },
301 HelpEntry {
302 tags: &[":q", ":quit"],
303 category: HelpCategory::Command,
304 summary: "Quit",
305 detail: "Exit Cell. Fails if there are unsaved changes.\nUse :q! to discard changes, or :wq to save and quit.",
306 },
307 HelpEntry {
308 tags: &[":q!"],
309 category: HelpCategory::Command,
310 summary: "Force quit",
311 detail: "Exit Cell without saving. All unsaved changes are discarded.",
312 },
313 HelpEntry {
314 tags: &[":wq"],
315 category: HelpCategory::Command,
316 summary: "Save and quit",
317 detail: "Write the current sheet to disk, then exit Cell.",
318 },
319 HelpEntry {
320 tags: &[":e", ":edit"],
321 category: HelpCategory::Command,
322 summary: "Open file",
323 detail: "Open a file for editing.\nUsage: :e <path>\n\nSupported formats: CSV, TSV, .cell (native format).",
324 },
325 HelpEntry {
326 tags: &[":sort"],
327 category: HelpCategory::Command,
328 summary: "Sort by column",
329 detail: "Sort all rows by the values in a column.\nUsage: :sort <column> [asc|desc]\n\nExamples:\n :sort A Sort by column A ascending\n :sort B desc Sort by column B descending",
330 },
331 HelpEntry {
332 tags: &[":help"],
333 category: HelpCategory::Command,
334 summary: "Open help",
335 detail: "Show this help screen.\nUsage: :help [topic]\n\n:help Show table of contents\n:help dd Show help for the dd command\n:help :w Show help for the :w command\n:help SUM Show help for the SUM formula",
336 },
337];
338
339pub static FORMULA_ENTRIES: &[HelpEntry] = &[
340 HelpEntry {
341 tags: &["SUM"],
342 category: HelpCategory::Formula,
343 summary: "Sum values in a range",
344 detail: "Returns the sum of all numeric values in the range.\nNon-numeric cells are ignored.\n\nUsage: =SUM(A1:A10)\n =SUM(B2:D5)",
345 },
346 HelpEntry {
347 tags: &["AVERAGE"],
348 category: HelpCategory::Formula,
349 summary: "Average of values in a range",
350 detail: "Returns the arithmetic mean of all numeric values in the range.\nNon-numeric cells are ignored. Returns #DIV/0! if no numeric\nvalues are found.\n\nUsage: =AVERAGE(A1:A10)",
351 },
352 HelpEntry {
353 tags: &["COUNT"],
354 category: HelpCategory::Formula,
355 summary: "Count numeric cells in a range",
356 detail: "Returns the number of cells containing numeric values in\nthe range. Non-numeric cells are not counted.\n\nUsage: =COUNT(A1:A10)",
357 },
358 HelpEntry {
359 tags: &["MIN"],
360 category: HelpCategory::Formula,
361 summary: "Minimum value in a range",
362 detail: "Returns the smallest numeric value in the range.\nNon-numeric cells are ignored. Returns 0 if no numeric\nvalues are found.\n\nUsage: =MIN(A1:A10)",
363 },
364 HelpEntry {
365 tags: &["MAX"],
366 category: HelpCategory::Formula,
367 summary: "Maximum value in a range",
368 detail: "Returns the largest numeric value in the range.\nNon-numeric cells are ignored. Returns 0 if no numeric\nvalues are found.\n\nUsage: =MAX(A1:A10)",
369 },
370 HelpEntry {
371 tags: &["IF"],
372 category: HelpCategory::Formula,
373 summary: "Conditional expression",
374 detail: "Returns one value if a condition is true, another if false.\n\nUsage: =IF(condition, value_if_true, value_if_false)\n\nExamples:\n =IF(A1>10, \"big\", \"small\")\n =IF(B2, C2, D2)",
375 },
376];