|
7 | 7 | - Operator functions live in src/lib/simulator/vim/operators.ts |
8 | 8 | - When spreading state with null assignments, always add explicit `: VimState` type annotation to avoid TypeScript inference narrowing |
9 | 9 | - Text objects live in src/lib/simulator/vim/textObjects.ts; use executeTextObject(state, type, objectKey) as main entry point |
| 10 | +- Command mode functions live in src/lib/simulator/vim/commands.ts; use handleCommandModeKey() for key processing, executeCommand() for command execution |
10 | 11 |
|
11 | 12 | --- |
12 | 13 |
|
@@ -190,3 +191,36 @@ Thread: http://localhost:8317/threads/T-019bbbc5-7313-761b-abcf-d6151d7a76a0 |
190 | 191 | - Block mode operations iterate line-by-line applying column ranges |
191 | 192 | - handleVisualModeKey() is main entry point for visual mode key processing |
192 | 193 | --- |
| 194 | + |
| 195 | +## 2026-01-14 - US-008 |
| 196 | +Thread: http://localhost:8317/threads/T-019bbbcb-c584-7239-9f58-79a8e0f024f9 |
| 197 | +- Implemented complete vim command mode in src/lib/simulator/vim/commands.ts: |
| 198 | + - : enters command mode, Escape cancels |
| 199 | + - :w/:write simulates write (sets modified=false, shows message) |
| 200 | + - :q/:quit simulates quit, :q! force quits |
| 201 | + - :wq/:x write and quit |
| 202 | + - :e/:edit {file} opens file in new buffer or switches to existing |
| 203 | + - :{number} goes to specific line number |
| 204 | + - :s/old/new/[g] substitutes on current line |
| 205 | + - :%s/old/new/g substitutes in entire file |
| 206 | + - :'<,'>s/old/new/g substitutes in visual selection range |
| 207 | + - :noh clears search highlighting |
| 208 | + - :set shows settings, :set {option} toggles, :set {option}? queries |
| 209 | + - :sp/:vs horizontal/vertical split (simulated) |
| 210 | + - :bn/:bp buffer next/previous |
| 211 | + - :bd buffer delete, :bd! force delete |
| 212 | + - :ls/:buffers list all buffers |
| 213 | + - :b {number|name} switch to buffer by number or partial name match |
| 214 | + - :marks shows all marks, :delmarks deletes marks |
| 215 | + - Command history navigation with up/down arrows |
| 216 | + - Tab completion for common commands |
| 217 | +- Updated src/lib/simulator/vim/index.ts to export commands |
| 218 | +- Files changed: 2 files (commands.ts new, index.ts updated) |
| 219 | +- **Learnings for future iterations:** |
| 220 | + - CommandResult includes optional shouldQuit flag for quit commands |
| 221 | + - enterCommandMode() sets buffer.mode to "command" and clears commandLine |
| 222 | + - handleCommandModeKey() is main entry point for command mode key processing |
| 223 | + - executeCommand() parses and executes the command string |
| 224 | + - Command history stored in state.commandLineHistory, index in commandLineHistoryIndex |
| 225 | + - Use explicit type-safe helper functions for VimSettings updates to avoid TypeScript inference issues |
| 226 | +--- |
0 commit comments