MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / nextVimWord

Method nextVimWord

src/utils/Cursor.ts:633–664  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

631 // 2. A sequence of non-blank, non-word characters (punctuation/symbols)
632
633 nextVimWord(): Cursor {
634 if (this.isAtEnd()) {
635 return this
636 }
637
638 let pos = this.offset
639 const advance = (p: number): number => this.measuredText.nextOffset(p)
640
641 const currentGrapheme = this.graphemeAt(pos)
642 if (!currentGrapheme) {
643 return this
644 }
645
646 if (isVimWordChar(currentGrapheme)) {
647 while (pos < this.text.length && isVimWordChar(this.graphemeAt(pos))) {
648 pos = advance(pos)
649 }
650 } else if (isVimPunctuation(currentGrapheme)) {
651 while (pos < this.text.length && isVimPunctuation(this.graphemeAt(pos))) {
652 pos = advance(pos)
653 }
654 }
655
656 while (
657 pos < this.text.length &&
658 WHITESPACE_REGEX.test(this.graphemeAt(pos))
659 ) {
660 pos = advance(pos)
661 }
662
663 return new Cursor(this.measuredText, pos)
664 }
665
666 endOfVimWord(): Cursor {
667 if (this.isAtEnd()) {

Callers 2

getOperatorRangeFunction · 0.80
applySingleMotionFunction · 0.80

Calls 5

isAtEndMethod · 0.95
graphemeAtMethod · 0.95
isVimWordCharFunction · 0.85
advanceFunction · 0.85
isVimPunctuationFunction · 0.85

Tested by

no test coverage detected