|
9 | 9 | - Text objects live in src/lib/simulator/vim/textObjects.ts; use executeTextObject(state, type, objectKey) as main entry point |
10 | 10 | - Command mode functions live in src/lib/simulator/vim/commands.ts; use handleCommandModeKey() for key processing, executeCommand() for command execution |
11 | 11 | - Macro functions live in src/lib/simulator/vim/macros.ts; use prepareMacroExecution() to get keystrokes array, caller is responsible for executing them |
| 12 | +- Leader key functions live in src/lib/simulator/vim/leader.ts; use handleLeaderKey() for processing leader sequences, enterLeaderMode() to activate |
12 | 13 |
|
13 | 14 | --- |
14 | 15 |
|
@@ -332,3 +333,60 @@ Thread: http://localhost:8317/threads/T-019bbbec-4388-7091-8ef6-c243c9e3acfe |
332 | 333 | - Time parsing supports seconds (s), minutes (m), hours (h), days (d) |
333 | 334 | - undoLineChanges attempts to find snapshot where cursor was on same line |
334 | 335 | --- |
| 336 | + |
| 337 | +## 2026-01-14 - US-013 |
| 338 | +Thread: http://localhost:8317/threads/T-019bbbf4-6ef2-77ea-8771-806fcb0b9ad1 |
| 339 | +- Implemented complete vim folding system in src/lib/simulator/vim/folding.ts: |
| 340 | + - za toggles fold under cursor |
| 341 | + - zo opens fold, zc closes fold |
| 342 | + - zO/zC opens/closes all folds recursively under cursor |
| 343 | + - zR opens all folds in file, zM closes all folds |
| 344 | + - zm increases fold level (close largest open), zr decreases (open smallest closed) |
| 345 | + - zj/zk move to next/previous fold |
| 346 | + - [z moves to start of fold, ]z to end |
| 347 | + - zd deletes fold, zE deletes all folds |
| 348 | + - Indent-based fold calculation via calculateIndentFolds() |
| 349 | + - getVisibleLines() for UI to render folded content |
| 350 | + - getFoldIndicator() generates fold preview text ("+-- N lines: preview...") |
| 351 | + - mapVisualLineToActual/mapActualLineToVisual for cursor positioning |
| 352 | + - executeFoldCommand() and handleFoldKey() for key processing |
| 353 | +- Updated src/lib/simulator/vim/index.ts to export folding module |
| 354 | +- Files changed: 2 files (folding.ts new, index.ts updated) |
| 355 | +- **Learnings for future iterations:** |
| 356 | + - Fold type already existed in types.ts with startLine, endLine, collapsed |
| 357 | + - Use getInnermostFoldAtLine() for innermost fold at cursor |
| 358 | + - Folding uses indent levels from tabstop setting for automatic fold generation |
| 359 | + - getVisibleLines() returns array with lineIndex and isFolded flag for rendering |
| 360 | +--- |
| 361 | + |
| 362 | +## 2026-01-14 - US-014 |
| 363 | +Thread: http://localhost:8317/threads/T-019bbc06-40f5-708e-bb6f-4f0d197cd328 |
| 364 | +- Implemented complete vim leader key system in src/lib/simulator/vim/leader.ts: |
| 365 | + - Space activates leader mode with 2-second timeout via enterLeaderMode() |
| 366 | + - Leader mode shows 'LEADER' in status bar, tracks key sequence |
| 367 | + - LEADER_MAPPINGS defines all Space+key sequences with sub-mappings |
| 368 | + - Space Space - find files, Space / - grep search, Space e - toggle explorer |
| 369 | + - Space f* - file finding (ff/fg/fr/fc/fb) |
| 370 | + - Space g* - git actions (gb/gl/gs/gd/gg) |
| 371 | + - Space s* - search actions (sb/sg/sw/sh/sk) |
| 372 | + - Space t* - terminal actions (tf/tb) |
| 373 | + - Space b* - buffer actions (bd delete, bn/bp next/prev) |
| 374 | + - Space u* - toggle options (us spell, uw wrap, ul line numbers, ud diagnostics, etc.) |
| 375 | + - Space c* - code actions (ca action, cr rename, cd definition, cf format) |
| 376 | + - Space v* - view actions (vv format, vs/vh splits) |
| 377 | + - Space w* - window navigation (wh/wj/wk/wl focus, wq close, w= equalize) |
| 378 | + - Two-key sequences work via nested subMappings (e.g., Space g b for git branches) |
| 379 | + - handleLeaderKey() processes keys with timeout checking |
| 380 | + - executeLeaderAction() performs actual actions (toggles, buffer ops, etc.) |
| 381 | + - getAvailableLeaderMappings() and getLeaderMappingHelp() for UI display |
| 382 | +- Added leaderActive, leaderKeySequence, leaderTimeoutAt fields to VimState in types.ts |
| 383 | +- Updated constants.ts to initialize leader state fields |
| 384 | +- Updated src/lib/simulator/vim/index.ts to export leader module |
| 385 | +- Files changed: 4 files (leader.ts new, types.ts, constants.ts, vim/index.ts updated) |
| 386 | +- **Learnings for future iterations:** |
| 387 | + - Leader mode uses timeout to auto-exit (LEADER_TIMEOUT_MS = 2000ms) |
| 388 | + - LeaderMapping interface supports nested subMappings for multi-key sequences |
| 389 | + - findMapping() recursively searches for exact or partial matches |
| 390 | + - Some toggle actions directly modify state.settings (wrap, line numbers, etc.) |
| 391 | + - Buffer operations (delete, next, prev) are handled in executeLeaderAction |
| 392 | +--- |
0 commit comments