MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / moveToWord

Function moveToWord

mini-code-edit/cm/keymap/vim.js:115–124  ·  view source on GitHub ↗
(cm, regexps, dir, where)

Source from the content-addressed store, hash-verified

113 return {from: Math.min(start, end), to: Math.max(start, end)};
114 }
115 function moveToWord(cm, regexps, dir, where) {
116 var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line), word;
117 while (true) {
118 word = findWord(line, ch, dir, regexps);
119 ch = word[where == "end" ? "to" : "from"];
120 if (ch == cur.ch && word.from != word.to) ch = word[dir < 0 ? "from" : "to"];
121 else break;
122 }
123 cm.setCursor(cur.line, word[where == "end" ? "to" : "from"], true);
124 }
125 function joinLineNext(cm) {
126 var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line);
127 CodeMirror.commands.goLineEnd(cm);

Callers 1

vim.jsFile · 0.85

Calls 1

findWordFunction · 0.85

Tested by

no test coverage detected