Skip to main content

cell_sheet_core/help/
entries.rs

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",
164        detail: "Open the search prompt. Type a pattern and press Enter to\nfind the next cell whose value contains the pattern.\nCase-insensitive.",
165    },
166    HelpEntry {
167        tags: &["n"],
168        category: HelpCategory::Normal,
169        summary: "Next search match",
170        detail: "Jump to the next cell matching the last search pattern.",
171    },
172    HelpEntry {
173        tags: &["N"],
174        category: HelpCategory::Normal,
175        summary: "Previous search match",
176        detail: "Jump to the previous cell matching the last search pattern.",
177    },
178];
179
180pub static INSERT_ENTRIES: &[HelpEntry] = &[
181    HelpEntry {
182        tags: &["Esc"],
183        category: HelpCategory::Insert,
184        summary: "Confirm edit, return to Normal",
185        detail: "Saves the current cell content and returns to Normal mode.",
186    },
187    HelpEntry {
188        tags: &["Enter-insert"],
189        category: HelpCategory::Insert,
190        summary: "Confirm edit and move down",
191        detail: "Saves the current cell content and returns to Normal mode.\nIn Insert mode, Enter confirms the edit (same as Esc).",
192    },
193    HelpEntry {
194        tags: &["Backspace"],
195        category: HelpCategory::Insert,
196        summary: "Delete character before cursor",
197        detail: "Deletes the character to the left of the cursor in the cell\nedit buffer.",
198    },
199    HelpEntry {
200        tags: &["Delete"],
201        category: HelpCategory::Insert,
202        summary: "Delete character at cursor",
203        detail: "Deletes the character at the cursor position in the cell\nedit buffer.",
204    },
205    HelpEntry {
206        tags: &["Left-insert", "Right-insert"],
207        category: HelpCategory::Insert,
208        summary: "Move cursor within cell",
209        detail: "Arrow keys move the cursor left/right within the cell edit\nbuffer during Insert mode.",
210    },
211    HelpEntry {
212        tags: &["Home"],
213        category: HelpCategory::Insert,
214        summary: "Move to start of cell",
215        detail: "Move the cursor to the beginning of the cell edit buffer.",
216    },
217    HelpEntry {
218        tags: &["End"],
219        category: HelpCategory::Insert,
220        summary: "Move to end of cell",
221        detail: "Move the cursor to the end of the cell edit buffer.",
222    },
223];
224
225pub static VISUAL_ENTRIES: &[HelpEntry] = &[
226    HelpEntry {
227        tags: &["v-visual"],
228        category: HelpCategory::Visual,
229        summary: "Enter Visual mode",
230        detail: "Start visual selection from Normal mode. The anchor is set at\nthe current cursor position.",
231    },
232    HelpEntry {
233        tags: &["Ctrl+V-visual"],
234        category: HelpCategory::Visual,
235        summary: "Enter Visual Block mode",
236        detail: "Start rectangular block selection from Normal mode.",
237    },
238    HelpEntry {
239        tags: &["d-visual"],
240        category: HelpCategory::Visual,
241        summary: "Delete selection",
242        detail: "Clear all cells in the visual selection. The contents are\nstored in the register. Returns to Normal mode.",
243    },
244    HelpEntry {
245        tags: &["y-visual"],
246        category: HelpCategory::Visual,
247        summary: "Yank selection",
248        detail: "Copy all cells in the visual selection to the register.\nReturns to Normal mode.",
249    },
250    HelpEntry {
251        tags: &["Esc-visual"],
252        category: HelpCategory::Visual,
253        summary: "Cancel selection",
254        detail: "Exit Visual mode and return to Normal mode without\nmodifying any cells.",
255    },
256];
257
258pub static COMMAND_ENTRIES: &[HelpEntry] = &[
259    HelpEntry {
260        tags: &[":w", ":write"],
261        category: HelpCategory::Command,
262        summary: "Save file",
263        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).",
264    },
265    HelpEntry {
266        tags: &[":w!"],
267        category: HelpCategory::Command,
268        summary: "Force save",
269        detail: "Write the current sheet to disk, even if formulas would be\nlost by saving as CSV/TSV.",
270    },
271    HelpEntry {
272        tags: &[":q", ":quit"],
273        category: HelpCategory::Command,
274        summary: "Quit",
275        detail: "Exit Cell. Fails if there are unsaved changes.\nUse :q! to discard changes, or :wq to save and quit.",
276    },
277    HelpEntry {
278        tags: &[":q!"],
279        category: HelpCategory::Command,
280        summary: "Force quit",
281        detail: "Exit Cell without saving. All unsaved changes are discarded.",
282    },
283    HelpEntry {
284        tags: &[":wq"],
285        category: HelpCategory::Command,
286        summary: "Save and quit",
287        detail: "Write the current sheet to disk, then exit Cell.",
288    },
289    HelpEntry {
290        tags: &[":e", ":edit"],
291        category: HelpCategory::Command,
292        summary: "Open file",
293        detail: "Open a file for editing.\nUsage: :e <path>\n\nSupported formats: CSV, TSV, .cell (native format).",
294    },
295    HelpEntry {
296        tags: &[":sort"],
297        category: HelpCategory::Command,
298        summary: "Sort by column",
299        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",
300    },
301    HelpEntry {
302        tags: &[":help"],
303        category: HelpCategory::Command,
304        summary: "Open help",
305        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",
306    },
307];
308
309pub static FORMULA_ENTRIES: &[HelpEntry] = &[
310    HelpEntry {
311        tags: &["SUM"],
312        category: HelpCategory::Formula,
313        summary: "Sum values in a range",
314        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)",
315    },
316    HelpEntry {
317        tags: &["AVERAGE"],
318        category: HelpCategory::Formula,
319        summary: "Average of values in a range",
320        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)",
321    },
322    HelpEntry {
323        tags: &["COUNT"],
324        category: HelpCategory::Formula,
325        summary: "Count numeric cells in a range",
326        detail: "Returns the number of cells containing numeric values in\nthe range. Non-numeric cells are not counted.\n\nUsage: =COUNT(A1:A10)",
327    },
328    HelpEntry {
329        tags: &["MIN"],
330        category: HelpCategory::Formula,
331        summary: "Minimum value in a range",
332        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)",
333    },
334    HelpEntry {
335        tags: &["MAX"],
336        category: HelpCategory::Formula,
337        summary: "Maximum value in a range",
338        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)",
339    },
340    HelpEntry {
341        tags: &["IF"],
342        category: HelpCategory::Formula,
343        summary: "Conditional expression",
344        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)",
345    },
346];