code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function isBinaryNumber(stream) { return stream.match(binaryMatcher); }
Author: Koh Zi Han, based on implementation by Koh Zi Chun
isBinaryNumber
javascript
cabloy/cabloy
src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js
MIT
function isOctalNumber(stream) { return stream.match(octalMatcher); }
Author: Koh Zi Han, based on implementation by Koh Zi Chun
isOctalNumber
javascript
cabloy/cabloy
src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js
MIT
function isDecimalNumber(stream, backup) { if (backup === true) { stream.backUp(1); } return stream.match(decimalMatcher); }
Author: Koh Zi Han, based on implementation by Koh Zi Chun
isDecimalNumber
javascript
cabloy/cabloy
src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js
MIT
function isHexNumber(stream) { return stream.match(hexMatcher); }
Author: Koh Zi Han, based on implementation by Koh Zi Chun
isHexNumber
javascript
cabloy/cabloy
src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/backend/static/lib/codemirror/mode/scheme/scheme.js
MIT
function autoCloseGT(cm) { if (cm.getOption('disableInput')) return CodeMirror.Pass; var ranges = cm.listSelections(), replacements = []; var opt = cm.getOption('autoCloseTags'); for (var i = 0; i < ranges.length; i++) { if (!ranges[i].empty()) return CodeMirror.Pass; var pos = ranges[...
Tag-closer extension for CodeMirror. This extension adds an "autoCloseTags" option that can be set to either true to get the default behavior, or an object to further configure its behavior. These are supported options: `whenClosing` (default true) Whether to autoclose when the '/' of a closing tag is typed. `when...
autoCloseGT
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
MIT
function autoCloseCurrent(cm, typingSlash) { var ranges = cm.listSelections(), replacements = []; var head = typingSlash ? '/' : '</'; var opt = cm.getOption('autoCloseTags'); var dontIndentOnAutoClose = typeof opt == 'object' && opt.dontIndentOnSlash; for (var i = 0; i < ranges.length; i++) {...
Tag-closer extension for CodeMirror. This extension adds an "autoCloseTags" option that can be set to either true to get the default behavior, or an object to further configure its behavior. These are supported options: `whenClosing` (default true) Whether to autoclose when the '/' of a closing tag is typed. `when...
autoCloseCurrent
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
MIT
function autoCloseSlash(cm) { if (cm.getOption('disableInput')) return CodeMirror.Pass; return autoCloseCurrent(cm, true); }
Tag-closer extension for CodeMirror. This extension adds an "autoCloseTags" option that can be set to either true to get the default behavior, or an object to further configure its behavior. These are supported options: `whenClosing` (default true) Whether to autoclose when the '/' of a closing tag is typed. `when...
autoCloseSlash
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
MIT
function indexOf(collection, elt) { if (collection.indexOf) return collection.indexOf(elt); for (var i = 0, e = collection.length; i < e; ++i) if (collection[i] == elt) return i; return -1; }
Tag-closer extension for CodeMirror. This extension adds an "autoCloseTags" option that can be set to either true to get the default behavior, or an object to further configure its behavior. These are supported options: `whenClosing` (default true) Whether to autoclose when the '/' of a closing tag is typed. `when...
indexOf
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
MIT
function closingTagExists(cm, context, tagName, pos, newTag) { if (!CodeMirror.scanForClosingTag) return false; var end = Math.min(cm.lastLine() + 1, pos.line + 500); var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end); if (!nextClose || nextClose.tag != tagName) return false; // If the...
Tag-closer extension for CodeMirror. This extension adds an "autoCloseTags" option that can be set to either true to get the default behavior, or an object to further configure its behavior. These are supported options: `whenClosing` (default true) Whether to autoclose when the '/' of a closing tag is typed. `when...
closingTagExists
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/addon/edit/closetag.js
MIT
Vim = function () { function enterVimMode(cm) { cm.setOption('disableInput', true); cm.setOption('showCursorWhenSelecting', false); CodeMirror.signal(cm, 'vim-mode-change', { mode: 'normal' }); cm.on('cursorActivity', onCursorActivity); maybeInitVimState(cm); CodeMirror.on(cm.get...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
Vim
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function enterVimMode(cm) { cm.setOption('disableInput', true); cm.setOption('showCursorWhenSelecting', false); CodeMirror.signal(cm, 'vim-mode-change', { mode: 'normal' }); cm.on('cursorActivity', onCursorActivity); maybeInitVimState(cm); CodeMirror.on(cm.getInputField(), 'paste', g...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
enterVimMode
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function leaveVimMode(cm) { cm.setOption('disableInput', false); cm.off('cursorActivity', onCursorActivity); CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); cm.state.vim = null; }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
leaveVimMode
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function detachVimMap(cm, next) { if (this == CodeMirror.keyMap.vim) { CodeMirror.rmClass(cm.getWrapperElement(), 'cm-fat-cursor'); if (cm.getOption('inputStyle') == 'contenteditable' && document.body.style.caretColor != null) { disableFatCursorMark(cm); cm.getInputField().styl...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
detachVimMap
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function attachVimMap(cm, prev) { if (this == CodeMirror.keyMap.vim) { CodeMirror.addClass(cm.getWrapperElement(), 'cm-fat-cursor'); if (cm.getOption('inputStyle') == 'contenteditable' && document.body.style.caretColor != null) { enableFatCursorMark(cm); cm.getInputField().styl...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
attachVimMap
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function updateFatCursorMark(cm) { if (!cm.state.fatCursorMarks) return; clearFatCursorMark(cm); var ranges = cm.listSelections(), result = []; for (var i = 0; i < ranges.length; i++) { var range = ranges[i]; if (range.empty()) { var lineLength = cm.getLine(rang...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
updateFatCursorMark
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function clearFatCursorMark(cm) { var marks = cm.state.fatCursorMarks; if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear(); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
clearFatCursorMark
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function enableFatCursorMark(cm) { cm.state.fatCursorMarks = []; updateFatCursorMark(cm); cm.on('cursorActivity', updateFatCursorMark); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
enableFatCursorMark
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function disableFatCursorMark(cm) { clearFatCursorMark(cm); cm.off('cursorActivity', updateFatCursorMark); // explicitly set fatCursorMarks to null because event listener above // can be invoke after removing it, if off is called from operation cm.state.fatCursorMarks = null; }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
disableFatCursorMark
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function cmKey(key, cm) { if (!cm) { return undefined; } if (this[key]) { return this[key]; } var vimKey = cmKeyToVimKey(key); if (!vimKey) { return false; } var cmd = CodeMirror.Vim.findKey(cm, vimKey); if (typeof cmd == 'function') { ...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
cmKey
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function cmKeyToVimKey(key) { if (key.charAt(0) == "'") { // Keypress character binding of format "'a'" return key.charAt(1); } var pieces = key.split(/-(?!$)/); var lastPiece = pieces[pieces.length - 1]; if (pieces.length == 1 && pieces[0].length == 1) { // No-modi...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
cmKeyToVimKey
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function getOnPasteFn(cm) { var vim = cm.state.vim; if (!vim.onPasteFn) { vim.onPasteFn = function () { if (!vim.insertMode) { cm.setCursor(offsetCursor(cm.getCursor(), 0, 1)); actions.enterInsertMode(cm, {}, vim); } }; } return vim.onP...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
getOnPasteFn
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function makeKeyRange(start, size) { var keys = []; for (var i = start; i < start + size; i++) { keys.push(String.fromCharCode(i)); } return keys; }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
makeKeyRange
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function isLine(cm, line) { return line >= cm.firstLine() && line <= cm.lastLine(); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
isLine
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function isLowerCase(k) { return /^[a-z]$/.test(k); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
isLowerCase
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function isMatchableSymbol(k) { return '()[]{}'.indexOf(k) != -1; }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
isMatchableSymbol
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function isNumber(k) { return numberRegex.test(k); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
isNumber
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function isUpperCase(k) { return upperCaseChars.test(k); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
isUpperCase
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function isWhiteSpaceString(k) { return /^\s*$/.test(k); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
isWhiteSpaceString
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function isEndOfSentenceSymbol(k) { return '.?!'.indexOf(k) != -1; }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
isEndOfSentenceSymbol
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function inArray(val, arr) { for (var i = 0; i < arr.length; i++) { if (arr[i] == val) { return true; } } return false; }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
inArray
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function defineOption(name, defaultValue, type, aliases, callback) { if (defaultValue === undefined && !callback) { throw Error('defaultValue is required unless callback is provided'); } if (!type) { type = 'string'; } options[name] = { type: type, defaultVa...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
defineOption
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function setOption(name, value, cm, cfg) { var option = options[name]; cfg = cfg || {}; var scope = cfg.scope; if (!option) { return new Error('Unknown option: ' + name); } if (option.type == 'boolean') { if (value && value !== true) { return new Error('Inva...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
setOption
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function getOption(name, cm, cfg) { var option = options[name]; cfg = cfg || {}; var scope = cfg.scope; if (!option) { return new Error('Unknown option: ' + name); } if (option.callback) { var local = cm && option.callback(undefined, cm); if (scope !== 'global...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
getOption
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
createCircularJumpList = function () { var size = 100; var pointer = -1; var head = 0; var tail = 0; var buffer = new Array(size); function add(cm, oldCur, newCur) { var current = pointer % size; var curMark = buffer[current]; function useNextSlot(cursor) { ...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
createCircularJumpList
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function add(cm, oldCur, newCur) { var current = pointer % size; var curMark = buffer[current]; function useNextSlot(cursor) { var next = ++pointer % size; var trashMark = buffer[next]; if (trashMark) { trashMark.clear(); } buffer[nex...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
add
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function useNextSlot(cursor) { var next = ++pointer % size; var trashMark = buffer[next]; if (trashMark) { trashMark.clear(); } buffer[next] = cm.setBookmark(cursor); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
useNextSlot
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function move(cm, offset) { pointer += offset; if (pointer > head) { pointer = head; } else if (pointer < tail) { pointer = tail; } var mark = buffer[(size + pointer) % size]; // skip marks that are temporarily removed from text buffer if (mark...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
move
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function find(cm, offset) { var oldPointer = pointer; var mark = move(cm, offset); pointer = oldPointer; return mark && mark.find(); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
find
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
createInsertModeChanges = function (c) { if (c) { // Copy construction return { changes: c.changes, expectCursorActivityForChange: c.expectCursorActivityForChange, }; } return { // Change list changes: [], // Set to true on change, fa...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
createInsertModeChanges
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function MacroModeState() { this.latestRegister = undefined; this.isPlaying = false; this.isRecording = false; this.replaySearchQueries = []; this.onRecordingDone = undefined; this.lastInsertModeChanges = createInsertModeChanges(); }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
MacroModeState
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function maybeInitVimState(cm) { if (!cm.state.vim) { // Store instance state in the CodeMirror object. cm.state.vim = { inputState: new InputState(), // Vim's input state that triggered the last edit, used to repeat // motions and operators with '.'. lastEd...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
maybeInitVimState
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function resetVimGlobalState() { vimGlobalState = { // The current search query. searchQuery: null, // Whether we are searching backwards. searchIsReversed: false, // Replace part of the last substituted pattern lastSubstituteReplacePart: undefined, jumpList...
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
resetVimGlobalState
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function toCtxArray(ctx) { return ctx ? [ctx] : ['normal', 'insert', 'visual']; }
Ex commands Care must be taken when adding to the default Ex command map. For any pair of commands that have a shared prefix, at least one of their shortNames must not match the prefix of the other command.
toCtxArray
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function handleMacroRecording() { var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isRecording) { if (key == 'q') { macroModeState.exitMacroRecordMode(); clearInputState(cm); return true; } if (origin...
This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. Finds a command based on the key (and cached keys if there is a multi-key sequence). Returns `undefined` if no key is matched, a noop function if a partial match is found (multi-key), and a function to execute th...
handleMacroRecording
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function handleEsc() { if (key == '<Esc>') { // Clear input state and get back to normal mode. clearInputState(cm); if (vim.visualMode) { exitVisualMode(cm); } else if (vim.insertMode) { exitInsertMode(cm); } r...
This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. Finds a command based on the key (and cached keys if there is a multi-key sequence). Returns `undefined` if no key is matched, a noop function if a partial match is found (multi-key), and a function to execute th...
handleEsc
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function doKeyToKey(keys) { // TODO: prevent infinite recursion. var match; while (keys) { // Pull off one command key, which is either a single character // or a special sequence wrapped in '<' and '>', e.g. '<Space>'. match = /<\w+-.+?>|<\w+>|./.exec(k...
This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. Finds a command based on the key (and cached keys if there is a multi-key sequence). Returns `undefined` if no key is matched, a noop function if a partial match is found (multi-key), and a function to execute th...
doKeyToKey
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function handleKeyInsertMode() { if (handleEsc()) { return true; } var keys = (vim.inputState.keyBuffer = vim.inputState.keyBuffer + key); var keysAreChars = key.length == 1; var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'in...
This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. Finds a command based on the key (and cached keys if there is a multi-key sequence). Returns `undefined` if no key is matched, a noop function if a partial match is found (multi-key), and a function to execute th...
handleKeyInsertMode
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function handleKeyNonInsertMode() { if (handleMacroRecording() || handleEsc()) { return true; } var keys = (vim.inputState.keyBuffer = vim.inputState.keyBuffer + key); if (/^[1-9]\d*$/.test(keys)) { return true; } var keysMatcher = /^...
This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. Finds a command based on the key (and cached keys if there is a multi-key sequence). Returns `undefined` if no key is matched, a noop function if a partial match is found (multi-key), and a function to execute th...
handleKeyNonInsertMode
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function InputState() { this.prefixRepeat = []; this.motionRepeat = []; this.operator = null; this.operatorArgs = null; this.motion = null; this.motionArgs = null; this.keyBuffer = []; // For matching multi-key commands. this.registerName = null; // Defaults to the unnam...
This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. Finds a command based on the key (and cached keys if there is a multi-key sequence). Returns `undefined` if no key is matched, a noop function if a partial match is found (multi-key), and a function to execute th...
InputState
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function clearInputState(cm, reason) { cm.state.vim.inputState = new InputState(); CodeMirror.signal(cm, 'vim-command-done', reason); }
This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. Finds a command based on the key (and cached keys if there is a multi-key sequence). Returns `undefined` if no key is matched, a noop function if a partial match is found (multi-key), and a function to execute th...
clearInputState
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function Register(text, linewise, blockwise) { this.clear(); this.keyBuffer = [text || '']; this.insertModeChanges = []; this.searchQueries = []; this.linewise = !!linewise; this.blockwise = !!blockwise; }
This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. Finds a command based on the key (and cached keys if there is a multi-key sequence). Returns `undefined` if no key is matched, a noop function if a partial match is found (multi-key), and a function to execute th...
Register
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function defineRegister(name, register) { var registers = vimGlobalState.registerController.registers; if (!name || name.length != 1) { throw Error('Register name must be 1 character'); } if (registers[name]) { throw Error('Register already defined ' + name); } regist...
Defines an external register. The name should be a single character that will be used to reference the register. The register should support setText, pushText, clear, and toString(). See Register for a reference implementation.
defineRegister
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function RegisterController(registers) { this.registers = registers; this.unnamedRegister = registers['"'] = new Register(); registers['.'] = new Register(); registers[':'] = new Register(); registers['/'] = new Register(); }
Defines an external register. The name should be a single character that will be used to reference the register. The register should support setText, pushText, clear, and toString(). See Register for a reference implementation.
RegisterController
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function HistoryController() { this.historyBuffer = []; this.iterator = 0; this.initialPrefix = null; }
Defines an external register. The name should be a single character that will be used to reference the register. The register should support setText, pushText, clear, and toString(). See Register for a reference implementation.
HistoryController
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function handleQuery(query, ignoreCase, smartCase) { vimGlobalState.searchHistoryController.pushInput(query); vimGlobalState.searchHistoryController.reset(); try { updateSearchQuery(cm, query, ignoreCase, smartCase); } catch (e) { showConfirm(cm, 'Invalid ...
Defines an external register. The name should be a single character that will be used to reference the register. The register should support setText, pushText, clear, and toString(). See Register for a reference implementation.
handleQuery
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function onPromptClose(query) { cm.scrollTo(originalScrollPos.left, originalScrollPos.top); handleQuery(query, true /** ignoreCase */, true /** smartCase */); var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isRecording) { logSearchQuery(macroMod...
Defines an external register. The name should be a single character that will be used to reference the register. The register should support setText, pushText, clear, and toString(). See Register for a reference implementation.
onPromptClose
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function defineOperator(name, fn) { operators[name] = fn; }
An operator acts on a text selection. It receives the list of selections as input. The corresponding CodeMirror selection is guaranteed to match the input selection.
defineOperator
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
whitespaceLength = function (str) { var tabs = str.split('\t').length - 1; var spaces = str.split(' ').length - 1; return tabs * tabSize + spaces * 1; }
An operator acts on a text selection. It receives the list of selections as input. The corresponding CodeMirror selection is guaranteed to match the input selection.
whitespaceLength
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function clipCursorToContent(cm, cur) { var vim = cm.state.vim; var includeLineBreak = vim.insertMode || vim.visualMode; var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine()); var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak; var ch = Math.min(Math.max(0, cur.ch),...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
clipCursorToContent
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function copyArgs(args) { var ret = {}; for (var prop in args) { if (args.hasOwnProperty(prop)) { ret[prop] = args[prop]; } } return ret; }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
copyArgs
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function offsetCursor(cur, offsetLine, offsetCh) { if (typeof offsetLine === 'object') { offsetCh = offsetLine.ch; offsetLine = offsetLine.line; } return Pos(cur.line + offsetLine, cur.ch + offsetCh); }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
offsetCursor
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function commandMatches(keys, keyMap, context, inputState) { // Partial matches are not applied. They inform the key handler // that the current key sequence is a subsequence of a valid key // sequence, so that the key buffer is not cleared. var match, partial = [], full = []; ...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
commandMatches
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function commandMatch(pressed, mapped) { if (mapped.slice(-11) == '<character>') { // Last character matches anything. var prefixLen = mapped.length - 11; var pressedPrefix = pressed.slice(0, prefixLen); var mappedPrefix = mapped.slice(0, prefixLen); return pressedPrefix ==...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
commandMatch
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function lastChar(keys) { var match = /^.*(<[^>]+>)$/.exec(keys); var selectedCharacter = match ? match[1] : keys.slice(-1); if (selectedCharacter.length > 1) { switch (selectedCharacter) { case '<CR>': selectedCharacter = '\n'; break; case '<Space>'...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
lastChar
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function repeatFn(cm, fn, repeat) { return function () { for (var i = 0; i < repeat; i++) { fn(cm); } }; }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
repeatFn
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function copyCursor(cur) { return Pos(cur.line, cur.ch); }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
copyCursor
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function cursorEqual(cur1, cur2) { return cur1.ch == cur2.ch && cur1.line == cur2.line; }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
cursorEqual
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function cursorIsBefore(cur1, cur2) { if (cur1.line < cur2.line) { return true; } if (cur1.line == cur2.line && cur1.ch < cur2.ch) { return true; } return false; }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
cursorIsBefore
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function cursorMin(cur1, cur2) { if (arguments.length > 2) { cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1)); } return cursorIsBefore(cur1, cur2) ? cur1 : cur2; }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
cursorMin
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function cursorMax(cur1, cur2) { if (arguments.length > 2) { cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1)); } return cursorIsBefore(cur1, cur2) ? cur2 : cur1; }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
cursorMax
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function cursorIsBetween(cur1, cur2, cur3) { // returns true if cur2 is between cur1 and cur3. var cur1before2 = cursorIsBefore(cur1, cur2); var cur2before3 = cursorIsBefore(cur2, cur3); return cur1before2 && cur2before3; }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
cursorIsBetween
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function lineLength(cm, lineNum) { return cm.getLine(lineNum).length; }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
lineLength
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function trim(s) { if (s.trim) { return s.trim(); } return s.replace(/^\s+|\s+$/g, ''); }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
trim
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function escapeRegex(s) { return s.replace(/([.?*+$\[\]\/\\(){}|\-])/g, '\\$1'); }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
escapeRegex
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function extendLineToColumn(cm, lineNum, column) { var endCh = lineLength(cm, lineNum); var spaces = new Array(column - endCh + 1).join(' '); cm.setCursor(Pos(lineNum, endCh)); cm.replaceRange(spaces, cm.getCursor()); }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
extendLineToColumn
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function selectBlock(cm, selectionEnd) { var selections = [], ranges = cm.listSelections(); var head = copyCursor(cm.clipPos(selectionEnd)); var isClipped = !cursorEqual(selectionEnd, head); var curHead = cm.getCursor('head'); var primIndex = getIndex(ranges, curHead); var wa...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
selectBlock
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function selectForInsert(cm, head, height) { var sel = []; for (var i = 0; i < height; i++) { var lineHead = offsetCursor(head, i, 0); sel.push({ anchor: lineHead, head: lineHead }); } cm.setSelections(sel, 0); }
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
selectForInsert
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function getIndex(ranges, cursor, end) { for (var i = 0; i < ranges.length; i++) { var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor); var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor); if (atAnchor || atHead) { return i; } } ...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
getIndex
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function getSelectedAreaRange(cm, vim) { var lastSelection = vim.lastSelection; var getCurrentSelectedAreaRange = function () { var selections = cm.listSelections(); var start = selections[0]; var end = selections[selections.length - 1]; var selectionStart = cursorIsBefore(st...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
getSelectedAreaRange
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
getCurrentSelectedAreaRange = function () { var selections = cm.listSelections(); var start = selections[0]; var end = selections[selections.length - 1]; var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head; var selectionEnd = cursorIsBefore(e...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
getCurrentSelectedAreaRange
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
getLastSelectedAreaRange = function () { var selectionStart = cm.getCursor(); var selectionEnd = cm.getCursor(); var block = lastSelection.visualBlock; if (block) { var width = block.width; var height = block.height; selectionEnd = Pos(selectionStart.line + ...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
getLastSelectedAreaRange
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function updateLastSelection(cm, vim) { var anchor = vim.sel.anchor; var head = vim.sel.head; // To accommodate the effect of lastPastedText in the last selection if (vim.lastPastedText) { head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length); vim.lastPasted...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
updateLastSelection
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function expandSelection(cm, start, end) { var sel = cm.state.vim.sel; var head = sel.head; var anchor = sel.anchor; var tmp; if (cursorIsBefore(end, start)) { tmp = end; end = start; start = tmp; } if (cursorIsBefore(head, anchor)) { head = curs...
Clips cursor to ensure that line is within the buffer's range If includeLineBreak is true, then allow cur.ch == lineLength.
expandSelection
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function updateCmSelection(cm, sel, mode) { var vim = cm.state.vim; sel = sel || vim.sel; var mode = mode || vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; var cmSel = makeCmSelection(cm, sel, mode); cm.setSelections(cmSel.ranges, cmSel.primary); updateFakeCursor(cm); ...
Updates the CodeMirror selection to match the provided vim selection. If no arguments are given, it uses the current vim selection state.
updateCmSelection
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function makeCmSelection(cm, sel, mode, exclusive) { var head = copyCursor(sel.head); var anchor = copyCursor(sel.anchor); if (mode == 'char') { var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0...
Updates the CodeMirror selection to match the provided vim selection. If no arguments are given, it uses the current vim selection state.
makeCmSelection
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function getHead(cm) { var cur = cm.getCursor('head'); if (cm.getSelection().length == 1) { // Small corner case when only 1 character is selected. The "real" // head is the left of head and anchor. cur = cursorMin(cur, cm.getCursor('anchor')); } return cur; }
Updates the CodeMirror selection to match the provided vim selection. If no arguments are given, it uses the current vim selection state.
getHead
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function exitVisualMode(cm, moveHead) { var vim = cm.state.vim; if (moveHead !== false) { cm.setCursor(clipCursorToContent(cm, vim.sel.head)); } updateLastSelection(cm, vim); vim.visualMode = false; vim.visualLine = false; vim.visualBlock = false; if (!vim.insertM...
If moveHead is set to false, the CodeMirror selection will not be touched. The caller assumes the responsibility of putting the cursor in the right place.
exitVisualMode
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function clipToLine(cm, curStart, curEnd) { var selection = cm.getRange(curStart, curEnd); // Only clip if the selection ends with trailing newline + whitespace if (/\n\s*$/.test(selection)) { var lines = selection.split('\n'); // We know this is all whitespace. lines.pop(); ...
If moveHead is set to false, the CodeMirror selection will not be touched. The caller assumes the responsibility of putting the cursor in the right place.
clipToLine
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function expandSelectionToLine(_cm, curStart, curEnd) { curStart.ch = 0; curEnd.ch = 0; curEnd.line++; }
If moveHead is set to false, the CodeMirror selection will not be touched. The caller assumes the responsibility of putting the cursor in the right place.
expandSelectionToLine
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function findFirstNonWhiteSpaceCharacter(text) { if (!text) { return 0; } var firstNonWS = text.search(/\S/); return firstNonWS == -1 ? text.length : firstNonWS; }
If moveHead is set to false, the CodeMirror selection will not be touched. The caller assumes the responsibility of putting the cursor in the right place.
findFirstNonWhiteSpaceCharacter
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) { var cur = getHead(cm); var line = cm.getLine(cur.line); var idx = cur.ch; // Seek to first word or non-whitespace character, depending on if // noSymbol is true. var test = noSymbol ? wordCharTest[0] : bigW...
If moveHead is set to false, the CodeMirror selection will not be touched. The caller assumes the responsibility of putting the cursor in the right place.
expandWordUnderCursor
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function expandTagUnderCursor(cm, head, inclusive) { var cur = head; if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) { return { start: cur, end: cur }; } var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head); if (!tags || !tags.o...
Depends on the following: - editor mode should be htmlmixedmode / xml - mode/xml/xml.js should be loaded - addon/fold/xml-fold.js should be loaded If any of the above requirements are not true, this function noops. This is _NOT_ a 100% accurate implementation of vim tag text objects. The following caveats apply (bas...
expandTagUnderCursor
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function recordJumpPosition(cm, oldCur, newCur) { if (!cursorEqual(oldCur, newCur)) { vimGlobalState.jumpList.add(cm, oldCur, newCur); } }
Depends on the following: - editor mode should be htmlmixedmode / xml - mode/xml/xml.js should be loaded - addon/fold/xml-fold.js should be loaded If any of the above requirements are not true, this function noops. This is _NOT_ a 100% accurate implementation of vim tag text objects. The following caveats apply (bas...
recordJumpPosition
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function recordLastCharacterSearch(increment, args) { vimGlobalState.lastCharacterSearch.increment = increment; vimGlobalState.lastCharacterSearch.forward = args.forward; vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter; }
Depends on the following: - editor mode should be htmlmixedmode / xml - mode/xml/xml.js should be loaded - addon/fold/xml-fold.js should be loaded If any of the above requirements are not true, this function noops. This is _NOT_ a 100% accurate implementation of vim tag text objects. The following caveats apply (bas...
recordLastCharacterSearch
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function findSymbol(cm, repeat, forward, symb) { var cur = copyCursor(cm.getCursor()); var increment = forward ? 1 : -1; var endLine = forward ? cm.lineCount() : -1; var curCh = cur.ch; var line = cur.line; var lineText = cm.getLine(line); var state = { lineText: lineTe...
Depends on the following: - editor mode should be htmlmixedmode / xml - mode/xml/xml.js should be loaded - addon/fold/xml-fold.js should be loaded If any of the above requirements are not true, this function noops. This is _NOT_ a 100% accurate implementation of vim tag text objects. The following caveats apply (bas...
findSymbol
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function findWord(cm, cur, forward, bigWord, emptyLineIsWord) { var lineNum = cur.line; var pos = cur.ch; var line = cm.getLine(lineNum); var dir = forward ? 1 : -1; var charTests = bigWord ? bigWordCharTest : wordCharTest; if (emptyLineIsWord && line == '') { lineNum += dir...
Depends on the following: - editor mode should be htmlmixedmode / xml - mode/xml/xml.js should be loaded - addon/fold/xml-fold.js should be loaded If any of the above requirements are not true, this function noops. This is _NOT_ a 100% accurate implementation of vim tag text objects. The following caveats apply (bas...
findWord
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) { var curStart = copyCursor(cur); var words = []; if ((forward && !wordEnd) || (!forward && wordEnd)) { repeat++; } // For 'e', empty lines are not considered words, go figure. var emptyLineIsWord = !(forward && ...
@param {CodeMirror} cm CodeMirror object. @param {Pos} cur The position to start from. @param {int} repeat Number of words to move past. @param {boolean} forward True to search forward. False to search backward. @param {boolean} wordEnd True to move to end of word. False to move to beginning of word. @param {bo...
moveToWord
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function moveToEol(cm, head, motionArgs, vim, keepHPos) { var cur = head; var retval = Pos(cur.line + motionArgs.repeat - 1, Infinity); var end = cm.clipPos(retval); end.ch--; if (!keepHPos) { vim.lastHPos = Infinity; vim.lastHSPos = cm.charCoords(end, 'div').left; } ...
@param {CodeMirror} cm CodeMirror object. @param {Pos} cur The position to start from. @param {int} repeat Number of words to move past. @param {boolean} forward True to search forward. False to search backward. @param {boolean} wordEnd True to move to end of word. False to move to beginning of word. @param {bo...
moveToEol
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function moveToCharacter(cm, repeat, forward, character) { var cur = cm.getCursor(); var start = cur.ch; var idx; for (var i = 0; i < repeat; i++) { var line = cm.getLine(cur.line); idx = charIdxInLine(start, line, character, forward, true); if (idx == -1) { ret...
@param {CodeMirror} cm CodeMirror object. @param {Pos} cur The position to start from. @param {int} repeat Number of words to move past. @param {boolean} forward True to search forward. False to search backward. @param {boolean} wordEnd True to move to end of word. False to move to beginning of word. @param {bo...
moveToCharacter
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT
function moveToColumn(cm, repeat) { // repeat is always >= 1, so repeat - 1 always corresponds // to the column we want to go to. var line = cm.getCursor().line; return clipCursorToContent(cm, Pos(line, repeat - 1)); }
@param {CodeMirror} cm CodeMirror object. @param {Pos} cur The position to start from. @param {int} repeat Number of words to move past. @param {boolean} forward True to search forward. False to search backward. @param {boolean} wordEnd True to move to end of word. False to move to beginning of word. @param {bo...
moveToColumn
javascript
cabloy/cabloy
src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-codemirror/dist/staticBackend/lib/codemirror/keymap/vim.js
MIT