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

Function setupPrefixBindingForKey

mini-code-edit/cm/keymap/vim.js:443–473  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

441 };
442
443 function setupPrefixBindingForKey(m) {
444 CodeMirror.keyMap["vim-prefix-m"][m] = function(cm) {
445 mark[m] = cm.getCursor().line;
446 };
447 CodeMirror.keyMap["vim-prefix-d'"][m] = function(cm) {
448 delTillMark(cm,m);
449 };
450 CodeMirror.keyMap["vim-prefix-y'"][m] = function(cm) {
451 yankTillMark(cm,m);
452 };
453 CodeMirror.keyMap["vim-prefix-r"][m] = function (cm) {
454 var cur = cm.getCursor();
455 cm.replaceRange(toLetter(m),
456 {line: cur.line, ch: cur.ch},
457 {line: cur.line, ch: cur.ch + 1});
458 CodeMirror.commands.goColumnLeft(cm);
459 };
460 // all commands, related to motions till char in line
461 iterObj(MOTION_OPTIONS, function (ch, options) {
462 CodeMirror.keyMap["vim-prefix-" + ch][m] = function(cm) {
463 moveTillChar(cm, m, options);
464 };
465 CodeMirror.keyMap["vim-prefix-d" + ch][m] = function(cm) {
466 delTillChar(cm, m, options);
467 };
468 CodeMirror.keyMap["vim-prefix-c" + ch][m] = function(cm) {
469 delTillChar(cm, m, options);
470 enterInsertMode(cm);
471 };
472 });
473 };
474 for (var i = 65; i < 65 + 26; i++) { // uppercase alphabet char codes
475 var ch = String.fromCharCode(i);
476 setupPrefixBindingForKey(toCombo(ch));

Callers 1

vim.jsFile · 0.85

Calls 7

delTillMarkFunction · 0.85
yankTillMarkFunction · 0.85
toLetterFunction · 0.85
iterObjFunction · 0.85
moveTillCharFunction · 0.85
delTillCharFunction · 0.85
enterInsertModeFunction · 0.85

Tested by

no test coverage detected