MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / getVimState

Function getVimState

static/js/codemirror/keymap/vim.js:333–356  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

331 return vimGlobalState;
332 }
333 function getVimState(cm) {
334 if (!cm.vimState) {
335 // Store instance state in the CodeMirror object.
336 cm.vimState = {
337 inputState: new InputState(),
338 // When using jk for navigation, if you move from a longer line to a
339 // shorter line, the cursor may clip to the end of the shorter line.
340 // If j is pressed again and cursor goes to the next line, the
341 // cursor should go back to its horizontal position on the longer
342 // line if it can. This is to keep track of the horizontal position.
343 lastHPos: -1,
344 // Doing the same with screen-position for gj/gk
345 lastHSPos: -1,
346 // The last motion command run. Cleared if a non-motion command gets
347 // executed in between.
348 lastMotion: null,
349 marks: {},
350 visualMode: false,
351 // If we are in visual line mode. No effect if visualMode is false.
352 visualLine: false
353 };
354 }
355 return cm.vimState;
356 }
357
358 var vimApi= {
359 buildKeyMap: function() {

Callers 3

VimFunction · 0.85
getSearchStateFunction · 0.85
doReplaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected