Commit 049f640
🤖 Fix: Vim 'e' motion and add '_' motion (#116)
Fixes two Vim mode bugs using TDD:
## Bug 1: `e` only jumps to end of current word
When cursor was at the end of a word, pressing `e` would not move to the
next word.
**Before:**
- Text: `hello world`
- Cursor on 'o' (end of "hello")
- Press `e` → stays at 'o' ❌
**After:**
- Cursor moves to 'd' (end of "world") ✅
## Bug 2: `_` motion not implemented
The `_` motion (jump to first non-whitespace character) was missing.
**Now supported:**
- `_` - Jump to first non-whitespace character
- `d_` - Delete to first non-whitespace character
- `c_` - Change to first non-whitespace character
- `y_` - Yank to first non-whitespace character
## Implementation Details
**TDD Approach:**
1. ✅ Wrote 6 failing tests first
2. ✅ Implemented fixes
3. ✅ All 45 tests passing
**Changes:**
- Fixed `moveWordEnd()` to detect when at end of word
- Added `moveToFirstNonWhitespace()` helper
- Wired up `_` motion in navigation and operator handlers
- Updated documentation
## Testing
```
45 pass
0 fail
81 expect() calls
```
_Generated with `cmux`_
---------
Co-authored-by: Ammar Bandukwala <ammar@ammar.io>1 parent 68e622a commit 049f640
3 files changed
+113
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
445 | 516 | | |
446 | 517 | | |
| 518 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
93 | 107 | | |
94 | 108 | | |
95 | 109 | | |
| |||
126 | 140 | | |
127 | 141 | | |
128 | 142 | | |
| 143 | + | |
129 | 144 | | |
130 | 145 | | |
131 | 146 | | |
| |||
135 | 150 | | |
136 | 151 | | |
137 | 152 | | |
138 | | - | |
| 153 | + | |
139 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
140 | 165 | | |
141 | 166 | | |
142 | 167 | | |
| |||
474 | 499 | | |
475 | 500 | | |
476 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
477 | 505 | | |
478 | 506 | | |
479 | 507 | | |
| |||
513 | 541 | | |
514 | 542 | | |
515 | 543 | | |
516 | | - | |
| 544 | + | |
517 | 545 | | |
518 | 546 | | |
519 | 547 | | |
| |||
530 | 558 | | |
531 | 559 | | |
532 | 560 | | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
533 | 564 | | |
534 | 565 | | |
535 | 566 | | |
| |||
541 | 572 | | |
542 | 573 | | |
543 | 574 | | |
544 | | - | |
| 575 | + | |
545 | 576 | | |
546 | 577 | | |
547 | 578 | | |
548 | | - | |
549 | | - | |
| 579 | + | |
| 580 | + | |
550 | 581 | | |
551 | 582 | | |
552 | 583 | | |
| |||
711 | 742 | | |
712 | 743 | | |
713 | 744 | | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
714 | 748 | | |
715 | 749 | | |
716 | 750 | | |
| |||
0 commit comments