MCPcopy
hub / github.com/codeaashu/claude-code / applySingleMotion

Function applySingleMotion

src/vim/motions.ts:30–67  ·  view source on GitHub ↗

* Apply a single motion step.

(key: string, cursor: Cursor)

Source from the content-addressed store, hash-verified

28 * Apply a single motion step.
29 */
30function applySingleMotion(key: string, cursor: Cursor): Cursor {
31 switch (key) {
32 case 'h':
33 return cursor.left()
34 case 'l':
35 return cursor.right()
36 case 'j':
37 return cursor.downLogicalLine()
38 case 'k':
39 return cursor.upLogicalLine()
40 case 'gj':
41 return cursor.down()
42 case 'gk':
43 return cursor.up()
44 case 'w':
45 return cursor.nextVimWord()
46 case 'b':
47 return cursor.prevVimWord()
48 case 'e':
49 return cursor.endOfVimWord()
50 case 'W':
51 return cursor.nextWORD()
52 case 'B':
53 return cursor.prevWORD()
54 case 'E':
55 return cursor.endOfWORD()
56 case '0':
57 return cursor.startOfLogicalLine()
58 case '^':
59 return cursor.firstNonBlankInLogicalLine()
60 case '$':
61 return cursor.endOfLogicalLine()
62 case 'G':
63 return cursor.startOfLastLine()
64 default:
65 return cursor
66 }
67}
68
69/**
70 * Check if a motion is inclusive (includes character at destination).

Callers 1

resolveMotionFunction · 0.85

Calls 15

leftMethod · 0.80
rightMethod · 0.80
downLogicalLineMethod · 0.80
upLogicalLineMethod · 0.80
downMethod · 0.80
upMethod · 0.80
nextVimWordMethod · 0.80
prevVimWordMethod · 0.80
endOfVimWordMethod · 0.80
nextWORDMethod · 0.80
prevWORDMethod · 0.80
endOfWORDMethod · 0.80

Tested by

no test coverage detected