MCPcopy Index your code
hub / github.com/codeaashu/claude-code / endOfVimWord

Method endOfVimWord

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

Source from the content-addressed store, hash-verified

689 }
690
691 endOfVimWord(): Cursor {
692 if (this.isAtEnd()) {
693 return this
694 }
695
696 const text = this.text
697 let pos = this.offset
698 const advance = (p: number): number => this.measuredText.nextOffset(p)
699
700 if (this.graphemeAt(pos) === '') {
701 return this
702 }
703
704 pos = advance(pos)
705
706 while (pos < text.length && WHITESPACE_REGEX.test(this.graphemeAt(pos))) {
707 pos = advance(pos)
708 }
709
710 if (pos >= text.length) {
711 return new Cursor(this.measuredText, text.length)
712 }
713
714 const charAtPos = this.graphemeAt(pos)
715 if (isVimWordChar(charAtPos)) {
716 while (pos < text.length) {
717 const nextPos = advance(pos)
718 if (nextPos >= text.length || !isVimWordChar(this.graphemeAt(nextPos)))
719 break
720 pos = nextPos
721 }
722 } else if (isVimPunctuation(charAtPos)) {
723 while (pos < text.length) {
724 const nextPos = advance(pos)
725 if (
726 nextPos >= text.length ||
727 !isVimPunctuation(this.graphemeAt(nextPos))
728 )
729 break
730 pos = nextPos
731 }
732 }
733
734 return new Cursor(this.measuredText, pos)
735 }
736
737 prevVimWord(): Cursor {
738 if (this.isAtStart()) {

Callers 2

getOperatorRangeFunction · 0.80
applySingleMotionFunction · 0.80

Calls 5

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

Tested by

no test coverage detected