1 |
- {"version":3,"file":"keybinding-vim-3ed22e9e.js","sources":["../../node_modules/ace-builds/src-noconflict/keybinding-vim.js"],"sourcesContent":["ace.define(\"ace/ext/hardwrap\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/editor\",\"ace/config\"], function(require, exports, module){\"use strict\";\nvar Range = require(\"../range\").Range;\nfunction hardWrap(editor, options) {\n var max = options.column || editor.getOption(\"printMarginColumn\");\n var allowMerge = options.allowMerge != false;\n var row = Math.min(options.startRow, options.endRow);\n var endRow = Math.max(options.startRow, options.endRow);\n var session = editor.session;\n while (row <= endRow) {\n var line = session.getLine(row);\n if (line.length > max) {\n var space = findSpace(line, max, 5);\n if (space) {\n var indentation = /^\\s*/.exec(line)[0];\n session.replace(new Range(row, space.start, row, space.end), \"\\n\" + indentation);\n }\n endRow++;\n }\n else if (allowMerge && /\\S/.test(line) && row != endRow) {\n var nextLine = session.getLine(row + 1);\n if (nextLine && /\\S/.test(nextLine)) {\n var trimmedLine = line.replace(/\\s+$/, \"\");\n var trimmedNextLine = nextLine.replace(/^\\s+/, \"\");\n var mergedLine = trimmedLine + \" \" + trimmedNextLine;\n var space = findSpace(mergedLine, max, 5);\n if (space && space.start > trimmedLine.length || mergedLine.length < max) {\n var replaceRange = new Range(row, trimmedLine.length, row + 1, nextLine.length - trimmedNextLine.length);\n session.replace(replaceRange, \" \");\n row--;\n endRow--;\n }\n else if (trimmedLine.length < line.length) {\n session.remove(new Range(row, trimmedLine.length, row, line.length));\n }\n }\n }\n row++;\n }\n function findSpace(line, max, min) {\n if (line.length < max)\n return;\n var before = line.slice(0, max);\n var after = line.slice(max);\n var spaceAfter = /^(?:(\\s+)|(\\S+)(\\s+))/.exec(after);\n var spaceBefore = /(?:(\\s+)|(\\s+)(\\S+))$/.exec(before);\n var start = 0;\n var end = 0;\n if (spaceBefore && !spaceBefore[2]) {\n start = max - spaceBefore[1].length;\n end = max;\n }\n if (spaceAfter && !spaceAfter[2]) {\n if (!start)\n start = max;\n end = max + spaceAfter[1].length;\n }\n if (start) {\n return {\n start: start,\n end: end\n };\n }\n if (spaceBefore && spaceBefore[2] && spaceBefore.index > min) {\n return {\n start: spaceBefore.index,\n end: spaceBefore.index + spaceBefore[2].length\n };\n }\n if (spaceAfter && spaceAfter[2]) {\n start = max + spaceAfter[2].length;\n return {\n start: start,\n end: start + spaceAfter[3].length\n };\n }\n }\n}\nfunction wrapAfterInput(e) {\n if (e.command.name == \"insertstring\" && /\\S/.test(e.args)) {\n var editor = e.editor;\n var cursor = editor.selection.cursor;\n if (cursor.column <= editor.renderer.$printMarginColumn)\n return;\n var lastDelta = editor.session.$undoManager.$lastDelta;\n hardWrap(editor, {\n startRow: cursor.row, endRow: cursor.row,\n allowMerge: false\n });\n if (lastDelta != editor.session.$undoManager.$lastDelta)\n editor.session.markUndoGroup();\n }\n}\nvar Editor = require(\"../editor\").Editor;\nrequire(\"../config\").defineOptions(Editor.prototype, \"editor\", {\n hardWrap: {\n set: function (val) {\n if (val) {\n this.commands.on(\"afterExec\", wrapAfterInput);\n }\n else {\n this.commands.off(\"afterExec\", wrapAfterInput);\n }\n },\n value: false\n }\n});\nexports.hardWrap = hardWrap;\n\n});\n\nace.define(\"ace/keyboard/vim\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/lib/dom\",\"ace/lib/oop\",\"ace/lib/keys\",\"ace/lib/event\",\"ace/search\",\"ace/lib/useragent\",\"ace/search_highlight\",\"ace/commands/multi_select_commands\",\"ace/mode/text\",\"ace/ext/hardwrap\",\"ace/multi_select\"], function(require, exports, module){// CodeMirror, copyright (c) by Marijn Haverbeke and others\n'use strict';\nfunction log() {\n var d = \"\";\n function format(p) {\n if (typeof p != \"object\")\n return p + \"\";\n if (\"line\" in p) {\n return p.line + \":\" + p.ch;\n }\n if (\"anchor\" in p) {\n return format(p.anchor) + \"->\" + format(p.head);\n }\n if (Array.isArray(p))\n return \"[\" + p.map(function (x) {\n return format(x);\n }) + \"]\";\n return JSON.stringify(p);\n }\n for (var i = 0; i < arguments.length; i++) {\n var p = arguments[i];\n var f = format(p);\n d += f + \" \";\n }\n console.log(d);\n}\nvar Range = require(\"../range\").Range;\nvar EventEmitter = require(\"../lib/event_emitter\").EventEmitter;\nvar domLib = require(\"../lib/dom\");\nvar oop = require(\"../lib/oop\");\nvar KEYS = require(\"../lib/keys\");\nvar event = require(\"../lib/event\");\nvar Search = require(\"../search\").Search;\nvar useragent = require(\"../lib/useragent\");\nvar SearchHighlight = require(\"../search_highlight\").SearchHighlight;\nvar multiSelectCommands = require(\"../commands/multi_select_commands\");\nvar TextModeTokenRe = require(\"../mode/text\").Mode.prototype.tokenRe;\nvar hardWrap = require(\"../ext/hardwrap\").hardWrap;\nrequire(\"../multi_select\");\nvar CodeMirror = function (ace) {\n this.ace = ace;\n this.state = {};\n this.marks = {};\n this.options = {};\n this.$uid = 0;\n this.onChange = this.onChange.bind(this);\n this.onSelectionChange = this.onSelectionChange.bind(this);\n this.onBeforeEndOperation = this.onBeforeEndOperation.bind(this);\n this.ace.on('change', this.onChange);\n this.ace.on('changeSelection', this.onSelectionChange);\n this.ace.on('beforeEndOperation', this.onBeforeEndOperation);\n};\nCodeMirror.Pos = function (line, ch) {\n if (!(this instanceof Pos))\n return new Pos(line, ch);\n this.line = line;\n this.ch = ch;\n};\nCodeMirror.defineOption = function (name, val, setter) { };\nCodeMirror.commands = {\n redo: function (cm) { cm.ace.redo(); },\n undo: function (cm) { cm.ace.undo(); },\n newlineAndIndent: function (cm) { cm.ace.insert(\"\\n\"); },\n goLineLeft: function (cm) { cm.ace.selection.moveCursorLineStart(); },\n goLineRight: function (cm) { cm.ace.selection.moveCursorLineEnd(); }\n};\nCodeMirror.keyMap = {};\nCodeMirror.addClass = CodeMirror.rmClass = function () { };\nCodeMirror.e_stop = CodeMirror.e_preventDefault = event.stopEvent;\nCodeMirror.keyName = function (e) {\n var key = (KEYS[e.keyCode] || e.key || \"\");\n if (key.length == 1)\n key = key.toUpperCase();\n key = event.getModifierString(e).replace(/(^|-)\\w/g, function (m) {\n return m.toUpperCase();\n }) + key;\n return key;\n};\nCodeMirror.keyMap['default'] = function (key) {\n return function (cm) {\n var cmd = cm.ace.commands.commandKeyBinding[key.toLowerCase()];\n return cmd && cm.ace.execCommand(cmd) !== false;\n };\n};\nCodeMirror.lookupKey = function lookupKey(key, map, handle) {\n if (!map)\n map = \"default\";\n if (typeof map == \"string\")\n map = CodeMirror.keyMap[map];\n var found = typeof map == \"function\" ? map(key) : map[key];\n if (found === false)\n return \"nothing\";\n if (found === \"...\")\n return \"multi\";\n if (found != null && handle(found))\n return \"handled\";\n if (map.fallthrough) {\n if (!Array.isArray(map.fallthrough))\n return lookupKey(key, map.fallthrough, handle);\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle);\n if (result)\n return result;\n }\n }\n};\nCodeMirror.findMatchingTag = function (cm, head) {\n return cm.findMatchingTag(head);\n};\nCodeMirror.findEnclosingTag = function (cm, head) {\n};\nCodeMirror.signal = function (o, name, e) { return o._signal(name, e); };\nCodeMirror.on = event.addListener;\nCodeMirror.off = event.removeListener;\nCodeMirror.isWordChar = function (ch) {\n if (ch < \"\\x7f\")\n return /^\\w$/.test(ch);\n TextModeTokenRe.lastIndex = 0;\n return TextModeTokenRe.test(ch);\n};\n(function () {\n oop.implement(CodeMirror.prototype, EventEmitter);\n this.destroy = function () {\n this.ace.off('change', this.onChange);\n this.ace.off('changeSelection', this.onSelectionChange);\n this.ace.off('beforeEndOperation', this.onBeforeEndOperation);\n this.removeOverlay();\n };\n this.virtualSelectionMode = function () {\n return this.ace.inVirtualSelectionMode && this.ace.selection.index;\n };\n this.onChange = function (delta) {\n var change = { text: delta.action[0] == 'i' ? delta.lines : [] };\n var curOp = this.curOp = this.curOp || {};\n if (!curOp.changeHandlers)\n curOp.changeHandlers = this._eventRegistry[\"change\"] && this._eventRegistry[\"change\"].slice();\n if (!curOp.lastChange) {\n curOp.lastChange = curOp.change = change;\n }\n else {\n curOp.lastChange.next = curOp.lastChange = change;\n }\n this.$updateMarkers(delta);\n };\n this.onSelectionChange = function () {\n var curOp = this.curOp = this.curOp || {};\n if (!curOp.cursorActivityHandlers)\n curOp.cursorActivityHandlers = this._eventRegistry[\"cursorActivity\"] && this._eventRegistry[\"cursorActivity\"].slice();\n this.curOp.cursorActivity = true;\n if (this.ace.inMultiSelectMode) {\n this.ace.keyBinding.removeKeyboardHandler(multiSelectCommands.keyboardHandler);\n }\n };\n this.operation = function (fn, force) {\n if (!force && this.curOp || force && this.curOp && this.curOp.force) {\n return fn();\n }\n if (force || !this.ace.curOp) {\n if (this.curOp)\n this.onBeforeEndOperation();\n }\n if (!this.ace.curOp) {\n var prevOp = this.ace.prevOp;\n this.ace.startOperation({\n command: { name: \"vim\", scrollIntoView: \"cursor\" }\n });\n }\n var curOp = this.curOp = this.curOp || {};\n this.curOp.force = force;\n var result = fn();\n if (this.ace.curOp && this.ace.curOp.command.name == \"vim\") {\n if (this.state.dialog)\n this.ace.curOp.command.scrollIntoView = this.ace.curOp.vimDialogScroll;\n this.ace.endOperation();\n if (!curOp.cursorActivity && !curOp.lastChange && prevOp)\n this.ace.prevOp = prevOp;\n }\n if (force || !this.ace.curOp) {\n if (this.curOp)\n this.onBeforeEndOperation();\n }\n return result;\n };\n this.onBeforeEndOperation = function () {\n var op = this.curOp;\n if (op) {\n if (op.change) {\n this.signal(\"change\", op.change, op);\n }\n if (op && op.cursorActivity) {\n this.signal(\"cursorActivity\", null, op);\n }\n this.curOp = null;\n }\n };\n this.signal = function (eventName, e, handlers) {\n var listeners = handlers ? handlers[eventName + \"Handlers\"]\n : (this._eventRegistry || {})[eventName];\n if (!listeners)\n return;\n listeners = listeners.slice();\n for (var i = 0; i < listeners.length; i++)\n listeners[i](this, e);\n };\n this.firstLine = function () { return 0; };\n this.lastLine = function () { return this.ace.session.getLength() - 1; };\n this.lineCount = function () { return this.ace.session.getLength(); };\n this.setCursor = function (line, ch) {\n if (typeof line === 'object') {\n ch = line.ch;\n line = line.line;\n }\n var shouldScroll = !this.curOp && !this.ace.inVirtualSelectionMode;\n if (!this.ace.inVirtualSelectionMode)\n this.ace.exitMultiSelectMode();\n this.ace.session.unfold({ row: line, column: ch });\n this.ace.selection.moveTo(line, ch);\n if (shouldScroll) {\n this.ace.renderer.scrollCursorIntoView();\n this.ace.endOperation();\n }\n };\n this.getCursor = function (p) {\n var sel = this.ace.selection;\n var pos = p == 'anchor' ? (sel.isEmpty() ? sel.lead : sel.anchor) :\n p == 'head' || !p ? sel.lead : sel.getRange()[p];\n return toCmPos(pos);\n };\n this.listSelections = function (p) {\n var ranges = this.ace.multiSelect.rangeList.ranges;\n if (!ranges.length || this.ace.inVirtualSelectionMode)\n return [{ anchor: this.getCursor('anchor'), head: this.getCursor('head') }];\n return ranges.map(function (r) {\n return {\n anchor: this.clipPos(toCmPos(r.cursor == r.end ? r.start : r.end)),\n head: this.clipPos(toCmPos(r.cursor))\n };\n }, this);\n };\n this.setSelections = function (p, primIndex) {\n var sel = this.ace.multiSelect;\n var ranges = p.map(function (x) {\n var anchor = toAcePos(x.anchor);\n var head = toAcePos(x.head);\n var r = Range.comparePoints(anchor, head) < 0\n ? new Range.fromPoints(anchor, head)\n : new Range.fromPoints(head, anchor);\n r.cursor = Range.comparePoints(r.start, head) ? r.end : r.start;\n return r;\n });\n if (this.ace.inVirtualSelectionMode) {\n this.ace.selection.fromOrientedRange(ranges[0]);\n return;\n }\n if (!primIndex) {\n ranges = ranges.reverse();\n }\n else if (ranges[primIndex]) {\n ranges.push(ranges.splice(primIndex, 1)[0]);\n }\n sel.toSingleRange(ranges[0].clone());\n var session = this.ace.session;\n for (var i = 0; i < ranges.length; i++) {\n var range = session.$clipRangeToDocument(ranges[i]); // todo why ace doesn't do this?\n sel.addRange(range);\n }\n };\n this.setSelection = function (a, h, options) {\n var sel = this.ace.selection;\n sel.moveTo(a.line, a.ch);\n sel.selectTo(h.line, h.ch);\n if (options && options.origin == '*mouse') {\n this.onBeforeEndOperation();\n }\n };\n this.somethingSelected = function (p) {\n return !this.ace.selection.isEmpty();\n };\n this.clipPos = function (p) {\n var pos = this.ace.session.$clipPositionToDocument(p.line, p.ch);\n return toCmPos(pos);\n };\n this.foldCode = function (pos) {\n this.ace.session.$toggleFoldWidget(pos.line, {});\n };\n this.markText = function (cursor) {\n return { clear: function () { }, find: function () { } };\n };\n this.$updateMarkers = function (delta) {\n var isInsert = delta.action == \"insert\";\n var start = delta.start;\n var end = delta.end;\n var rowShift = (end.row - start.row) * (isInsert ? 1 : -1);\n var colShift = (end.column - start.column) * (isInsert ? 1 : -1);\n if (isInsert)\n end = start;\n for (var i in this.marks) {\n var point = this.marks[i];\n var cmp = Range.comparePoints(point, start);\n if (cmp < 0) {\n continue; // delta starts after the range\n }\n if (cmp === 0) {\n if (isInsert) {\n if (point.bias == 1) {\n cmp = 1;\n }\n else {\n point.bias = -1;\n continue;\n }\n }\n }\n var cmp2 = isInsert ? cmp : Range.comparePoints(point, end);\n if (cmp2 > 0) {\n point.row += rowShift;\n point.column += point.row == end.row ? colShift : 0;\n continue;\n }\n if (!isInsert && cmp2 <= 0) {\n point.row = start.row;\n point.column = start.column;\n if (cmp2 === 0)\n point.bias = 1;\n }\n }\n };\n var Marker = function (cm, id, row, column) {\n this.cm = cm;\n this.id = id;\n this.row = row;\n this.column = column;\n cm.marks[this.id] = this;\n };\n Marker.prototype.clear = function () { delete this.cm.marks[this.id]; };\n Marker.prototype.find = function () { return toCmPos(this); };\n this.setBookmark = function (cursor, options) {\n var bm = new Marker(this, this.$uid++, cursor.line, cursor.ch);\n if (!options || !options.insertLeft)\n bm.$insertRight = true;\n this.marks[bm.id] = bm;\n return bm;\n };\n this.moveH = function (increment, unit) {\n if (unit == 'char') {\n var sel = this.ace.selection;\n sel.clearSelection();\n sel.moveCursorBy(0, increment);\n }\n };\n this.findPosV = function (start, amount, unit, goalColumn) {\n if (unit == 'page') {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n amount = amount * Math.floor(config.height / config.lineHeight);\n unit = 'line';\n }\n if (unit == 'line') {\n var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch);\n if (goalColumn != null)\n screenPos.column = goalColumn;\n screenPos.row += amount;\n screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1);\n var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column);\n return toCmPos(pos);\n }\n else {\n debugger;\n }\n };\n this.charCoords = function (pos, mode) {\n if (mode == 'div' || !mode) {\n var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch);\n return { left: sc.column, top: sc.row };\n }\n if (mode == 'local') {\n var renderer = this.ace.renderer;\n var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch);\n var lh = renderer.layerConfig.lineHeight;\n var cw = renderer.layerConfig.characterWidth;\n var top = lh * sc.row;\n return { left: sc.column * cw, top: top, bottom: top + lh };\n }\n };\n this.coordsChar = function (pos, mode) {\n var renderer = this.ace.renderer;\n if (mode == 'local') {\n var row = Math.max(0, Math.floor(pos.top / renderer.lineHeight));\n var col = Math.max(0, Math.floor(pos.left / renderer.characterWidth));\n var ch = renderer.session.screenToDocumentPosition(row, col);\n return toCmPos(ch);\n }\n else if (mode == 'div') {\n throw \"not implemented\";\n }\n };\n this.getSearchCursor = function (query, pos, caseFold) {\n var caseSensitive = false;\n var isRegexp = false;\n if (query instanceof RegExp && !query.global) {\n caseSensitive = !query.ignoreCase;\n query = query.source;\n isRegexp = true;\n }\n if (query == \"\\\\n\") {\n query = \"\\n\";\n isRegexp = false;\n }\n var search = new Search();\n if (pos.ch == undefined)\n pos.ch = Number.MAX_VALUE;\n var acePos = { row: pos.line, column: pos.ch };\n var cm = this;\n var last = null;\n return {\n findNext: function () { return this.find(false); },\n findPrevious: function () { return this.find(true); },\n find: function (back) {\n search.setOptions({\n needle: query,\n caseSensitive: caseSensitive,\n wrap: false,\n backwards: back,\n regExp: isRegexp,\n start: last || acePos\n });\n var range = search.find(cm.ace.session);\n last = range;\n return last && [!last.isEmpty()];\n },\n from: function () { return last && toCmPos(last.start); },\n to: function () { return last && toCmPos(last.end); },\n replace: function (text) {\n if (last) {\n last.end = cm.ace.session.doc.replace(last, text);\n }\n }\n };\n };\n this.scrollTo = function (x, y) {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n var maxHeight = config.maxHeight;\n maxHeight -= (renderer.$size.scrollerHeight - renderer.lineHeight) * renderer.$scrollPastEnd;\n if (y != null)\n this.ace.session.setScrollTop(Math.max(0, Math.min(y, maxHeight)));\n if (x != null)\n this.ace.session.setScrollLeft(Math.max(0, Math.min(x, config.width)));\n };\n this.scrollInfo = function () { return 0; };\n this.scrollIntoView = function (pos, margin) {\n if (pos) {\n var renderer = this.ace.renderer;\n var viewMargin = { \"top\": 0, \"bottom\": margin };\n renderer.scrollCursorIntoView(toAcePos(pos), (renderer.lineHeight * 2) / renderer.$size.scrollerHeight, viewMargin);\n }\n };\n this.getLine = function (row) { return this.ace.session.getLine(row); };\n this.getRange = function (s, e) {\n return this.ace.session.getTextRange(new Range(s.line, s.ch, e.line, e.ch));\n };\n this.replaceRange = function (text, s, e) {\n if (!e)\n e = s;\n var range = new Range(s.line, s.ch, e.line, e.ch);\n this.ace.session.$clipRangeToDocument(range);\n return this.ace.session.replace(range, text);\n };\n this.replaceSelection =\n this.replaceSelections = function (p) {\n var sel = this.ace.selection;\n if (this.ace.inVirtualSelectionMode) {\n this.ace.session.replace(sel.getRange(), p[0] || \"\");\n return;\n }\n sel.inVirtualSelectionMode = true;\n var ranges = sel.rangeList.ranges;\n if (!ranges.length)\n ranges = [this.ace.multiSelect.getRange()];\n for (var i = ranges.length; i--;)\n this.ace.session.replace(ranges[i], p[i] || \"\");\n sel.inVirtualSelectionMode = false;\n };\n this.getSelection = function () {\n return this.ace.getSelectedText();\n };\n this.getSelections = function () {\n return this.listSelections().map(function (x) {\n return this.getRange(x.anchor, x.head);\n }, this);\n };\n this.getInputField = function () {\n return this.ace.textInput.getElement();\n };\n this.getWrapperElement = function () {\n return this.ace.container;\n };\n var optMap = {\n indentWithTabs: \"useSoftTabs\",\n indentUnit: \"tabSize\",\n tabSize: \"tabSize\",\n firstLineNumber: \"firstLineNumber\",\n readOnly: \"readOnly\"\n };\n this.setOption = function (name, val) {\n this.state[name] = val;\n switch (name) {\n case 'indentWithTabs':\n name = optMap[name];\n val = !val;\n break;\n case 'keyMap':\n this.state.$keyMap = val;\n return;\n break;\n default:\n name = optMap[name];\n }\n if (name)\n this.ace.setOption(name, val);\n };\n this.getOption = function (name) {\n var val;\n var aceOpt = optMap[name];\n if (aceOpt)\n val = this.ace.getOption(aceOpt);\n switch (name) {\n case 'indentWithTabs':\n name = optMap[name];\n return !val;\n case 'keyMap':\n return this.state.$keyMap || 'vim';\n }\n return aceOpt ? val : this.state[name];\n };\n this.toggleOverwrite = function (on) {\n this.state.overwrite = on;\n return this.ace.setOverwrite(on);\n };\n this.addOverlay = function (o) {\n if (!this.$searchHighlight || !this.$searchHighlight.session) {\n var highlight = new SearchHighlight(null, \"ace_highlight-marker\", \"text\");\n var marker = this.ace.session.addDynamicMarker(highlight);\n highlight.id = marker.id;\n highlight.session = this.ace.session;\n highlight.destroy = function (o) {\n highlight.session.off(\"change\", highlight.updateOnChange);\n highlight.session.off(\"changeEditor\", highlight.destroy);\n highlight.session.removeMarker(highlight.id);\n highlight.session = null;\n };\n highlight.updateOnChange = function (delta) {\n var row = delta.start.row;\n if (row == delta.end.row)\n highlight.cache[row] = undefined;\n else\n highlight.cache.splice(row, highlight.cache.length);\n };\n highlight.session.on(\"changeEditor\", highlight.destroy);\n highlight.session.on(\"change\", highlight.updateOnChange);\n }\n var re = new RegExp(o.query.source, \"gmi\");\n this.$searchHighlight = o.highlight = highlight;\n this.$searchHighlight.setRegexp(re);\n this.ace.renderer.updateBackMarkers();\n };\n this.removeOverlay = function (o) {\n if (this.$searchHighlight && this.$searchHighlight.session) {\n this.$searchHighlight.destroy();\n }\n };\n this.getScrollInfo = function () {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n return {\n left: renderer.scrollLeft,\n top: renderer.scrollTop,\n height: config.maxHeight,\n width: config.width,\n clientHeight: config.height,\n clientWidth: config.width\n };\n };\n this.getValue = function () {\n return this.ace.getValue();\n };\n this.setValue = function (v) {\n return this.ace.setValue(v, -1);\n };\n this.getTokenTypeAt = function (pos) {\n var token = this.ace.session.getTokenAt(pos.line, pos.ch);\n return token && /comment|string/.test(token.type) ? \"string\" : \"\";\n };\n this.findMatchingBracket = function (pos) {\n var m = this.ace.session.findMatchingBracket(toAcePos(pos));\n return { to: m && toCmPos(m) };\n };\n this.findMatchingTag = function (pos) {\n var m = this.ace.session.getMatchingTags(toAcePos(pos));\n if (!m)\n return;\n return {\n open: {\n from: toCmPos(m.openTag.start),\n to: toCmPos(m.openTag.end)\n },\n close: {\n from: toCmPos(m.closeTag.start),\n to: toCmPos(m.closeTag.end)\n }\n };\n };\n this.indentLine = function (line, method) {\n if (method === true)\n this.ace.session.indentRows(line, line, \"\\t\");\n else if (method === false)\n this.ace.session.outdentRows(new Range(line, 0, line, 0));\n };\n this.indexFromPos = function (pos) {\n return this.ace.session.doc.positionToIndex(toAcePos(pos));\n };\n this.posFromIndex = function (index) {\n return toCmPos(this.ace.session.doc.indexToPosition(index));\n };\n this.focus = function (index) {\n return this.ace.textInput.focus();\n };\n this.blur = function (index) {\n return this.ace.blur();\n };\n this.defaultTextHeight = function (index) {\n return this.ace.renderer.layerConfig.lineHeight;\n };\n this.scanForBracket = function (pos, dir, _, options) {\n var re = options.bracketRegex.source;\n var tokenRe = /paren|text|operator|tag/;\n if (dir == 1) {\n var m = this.ace.session.$findClosingBracket(re.slice(1, 2), toAcePos(pos), tokenRe);\n }\n else {\n var m = this.ace.session.$findOpeningBracket(re.slice(-2, -1), { row: pos.line, column: pos.ch + 1 }, tokenRe);\n }\n return m && { pos: toCmPos(m) };\n };\n this.refresh = function () {\n return this.ace.resize(true);\n };\n this.getMode = function () {\n return { name: this.getOption(\"mode\") };\n };\n this.execCommand = function (name) {\n if (CodeMirror.commands.hasOwnProperty(name))\n return CodeMirror.commands[name](this);\n if (name == \"indentAuto\")\n return this.ace.execCommand(\"autoindent\");\n console.log(name + \" is not implemented\");\n };\n this.getLineNumber = function (handle) {\n return handle.row;\n };\n this.getLineHandle = function (row) {\n return { text: this.ace.session.getLine(row), row: row };\n };\n}).call(CodeMirror.prototype);\nfunction toAcePos(cmPos) {\n return { row: cmPos.line, column: cmPos.ch };\n}\nfunction toCmPos(acePos) {\n return new Pos(acePos.row, acePos.column);\n}\nvar StringStream = CodeMirror.StringStream = function (string, tabSize) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n};\nStringStream.prototype = {\n eol: function () { return this.pos >= this.string.length; },\n sol: function () { return this.pos == this.lineStart; },\n peek: function () { return this.string.charAt(this.pos) || undefined; },\n next: function () {\n if (this.pos < this.string.length)\n return this.string.charAt(this.pos++);\n },\n eat: function (match) {\n var ch = this.string.charAt(this.pos);\n if (typeof match == \"string\")\n var ok = ch == match;\n else\n var ok = ch && (match.test ? match.test(ch) : match(ch));\n if (ok) {\n ++this.pos;\n return ch;\n }\n },\n eatWhile: function (match) {\n var start = this.pos;\n while (this.eat(match)) { }\n return this.pos > start;\n },\n eatSpace: function () {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos)))\n ++this.pos;\n return this.pos > start;\n },\n skipToEnd: function () { this.pos = this.string.length; },\n skipTo: function (ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {\n this.pos = found;\n return true;\n }\n },\n backUp: function (n) { this.pos -= n; },\n column: function () {\n throw \"not implemented\";\n },\n indentation: function () {\n throw \"not implemented\";\n },\n match: function (pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false)\n this.pos += pattern.length;\n return true;\n }\n }\n else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0)\n return null;\n if (match && consume !== false)\n this.pos += match[0].length;\n return match;\n }\n },\n current: function () { return this.string.slice(this.start, this.pos); },\n hideFirstChars: function (n, inner) {\n this.lineStart += n;\n try {\n return inner();\n }\n finally {\n this.lineStart -= n;\n }\n }\n};\nCodeMirror.defineExtension = function (name, fn) {\n CodeMirror.prototype[name] = fn;\n};\ndomLib.importCssString(\".normal-mode .ace_cursor{\\n border: none;\\n background-color: rgba(255,0,0,0.5);\\n}\\n.normal-mode .ace_hidden-cursors .ace_cursor{\\n background-color: transparent;\\n border: 1px solid red;\\n opacity: 0.7\\n}\\n.ace_dialog {\\n position: absolute;\\n left: 0; right: 0;\\n background: inherit;\\n z-index: 15;\\n padding: .1em .8em;\\n overflow: hidden;\\n color: inherit;\\n}\\n.ace_dialog-top {\\n border-bottom: 1px solid #444;\\n top: 0;\\n}\\n.ace_dialog-bottom {\\n border-top: 1px solid #444;\\n bottom: 0;\\n}\\n.ace_dialog input {\\n border: none;\\n outline: none;\\n background: transparent;\\n width: 20em;\\n color: inherit;\\n font-family: monospace;\\n}\", \"vimMode\", false);\n(function () {\n function dialogDiv(cm, template, bottom) {\n var wrap = cm.ace.container;\n var dialog;\n dialog = wrap.appendChild(document.createElement(\"div\"));\n if (bottom)\n dialog.className = \"ace_dialog ace_dialog-bottom\";\n else\n dialog.className = \"ace_dialog ace_dialog-top\";\n if (typeof template == \"string\") {\n dialog.innerHTML = template;\n }\n else { // Assuming it's a detached DOM element.\n dialog.appendChild(template);\n }\n return dialog;\n }\n function closeNotification(cm, newVal) {\n if (cm.state.currentNotificationClose)\n cm.state.currentNotificationClose();\n cm.state.currentNotificationClose = newVal;\n }\n CodeMirror.defineExtension(\"openDialog\", function (template, callback, options) {\n if (this.virtualSelectionMode())\n return;\n if (!options)\n options = {};\n closeNotification(this, null);\n var dialog = dialogDiv(this, template, options.bottom);\n var closed = false, me = this;\n this.state.dialog = dialog;\n function close(newVal) {\n if (typeof newVal == 'string') {\n inp.value = newVal;\n }\n else {\n if (closed)\n return;\n if (newVal && newVal.type == \"blur\") {\n if (document.activeElement === inp)\n return;\n }\n if (me.state.dialog == dialog) {\n me.state.dialog = null;\n me.focus();\n }\n closed = true;\n dialog.remove();\n if (options.onClose)\n options.onClose(dialog);\n var cm = me;\n if (cm.state.vim) {\n cm.state.vim.status = null;\n cm.ace._signal(\"changeStatus\");\n cm.ace.renderer.$loop.schedule(cm.ace.renderer.CHANGE_CURSOR);\n }\n }\n }\n var inp = dialog.getElementsByTagName(\"input\")[0], button;\n if (inp) {\n if (options.value) {\n inp.value = options.value;\n if (options.selectValueOnOpen !== false)\n inp.select();\n }\n if (options.onInput)\n CodeMirror.on(inp, \"input\", function (e) { options.onInput(e, inp.value, close); });\n if (options.onKeyUp)\n CodeMirror.on(inp, \"keyup\", function (e) { options.onKeyUp(e, inp.value, close); });\n CodeMirror.on(inp, \"keydown\", function (e) {\n if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) {\n return;\n }\n if (e.keyCode == 13)\n callback(inp.value);\n if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {\n CodeMirror.e_stop(e);\n close();\n }\n });\n if (options.closeOnBlur !== false)\n CodeMirror.on(inp, \"blur\", close);\n inp.focus();\n }\n else if (button = dialog.getElementsByTagName(\"button\")[0]) {\n CodeMirror.on(button, \"click\", function () {\n close();\n me.focus();\n });\n if (options.closeOnBlur !== false)\n CodeMirror.on(button, \"blur\", close);\n button.focus();\n }\n return close;\n });\n CodeMirror.defineExtension(\"openNotification\", function (template, options) {\n if (this.virtualSelectionMode())\n return;\n closeNotification(this, close);\n var dialog = dialogDiv(this, template, options && options.bottom);\n var closed = false, doneTimer;\n var duration = options && typeof options.duration !== \"undefined\" ? options.duration : 5000;\n function close() {\n if (closed)\n return;\n closed = true;\n clearTimeout(doneTimer);\n dialog.remove();\n }\n CodeMirror.on(dialog, 'click', function (e) {\n CodeMirror.e_preventDefault(e);\n close();\n });\n if (duration)\n doneTimer = setTimeout(close, duration);\n return close;\n });\n})();\nvar Pos = CodeMirror.Pos;\nfunction transformCursor(cm, range) {\n var vim = cm.state.vim;\n if (!vim || vim.insertMode)\n return range.head;\n var head = vim.sel.head;\n if (!head)\n return range.head;\n if (vim.visualBlock) {\n if (range.head.line != head.line) {\n return;\n }\n }\n if (range.from() == range.anchor && !range.empty()) {\n if (range.head.line == head.line && range.head.ch != head.ch)\n return new Pos(range.head.line, range.head.ch - 1);\n }\n return range.head;\n}\nfunction updateSelectionForSurrogateCharacters(cm, curStart, curEnd) {\n if (curStart.line === curEnd.line && curStart.ch >= curEnd.ch - 1) {\n var text = cm.getLine(curStart.line);\n var charCode = text.charCodeAt(curStart.ch);\n if (0xD800 <= charCode && charCode <= 0xD8FF) {\n curEnd.ch += 1;\n }\n }\n return { start: curStart, end: curEnd };\n}\nvar defaultKeymap = [\n { keys: '<Left>', type: 'keyToKey', toKeys: 'h' },\n { keys: '<Right>', type: 'keyToKey', toKeys: 'l' },\n { keys: '<Up>', type: 'keyToKey', toKeys: 'k' },\n { keys: '<Down>', type: 'keyToKey', toKeys: 'j' },\n { keys: 'g<Up>', type: 'keyToKey', toKeys: 'gk' },\n { keys: 'g<Down>', type: 'keyToKey', toKeys: 'gj' },\n { keys: '<Space>', type: 'keyToKey', toKeys: 'l' },\n { keys: '<BS>', type: 'keyToKey', toKeys: 'h', context: 'normal' },\n { keys: '<Del>', type: 'keyToKey', toKeys: 'x', context: 'normal' },\n { keys: '<C-Space>', type: 'keyToKey', toKeys: 'W' },\n { keys: '<C-BS>', type: 'keyToKey', toKeys: 'B', context: 'normal' },\n { keys: '<S-Space>', type: 'keyToKey', toKeys: 'w' },\n { keys: '<S-BS>', type: 'keyToKey', toKeys: 'b', context: 'normal' },\n { keys: '<C-n>', type: 'keyToKey', toKeys: 'j' },\n { keys: '<C-p>', type: 'keyToKey', toKeys: 'k' },\n { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>' },\n { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>' },\n { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },\n { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },\n { keys: '<C-Esc>', type: 'keyToKey', toKeys: '<Esc>' },\n { keys: '<C-Esc>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },\n { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },\n { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual' },\n { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },\n { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' },\n { keys: '<Home>', type: 'keyToKey', toKeys: '0' },\n { keys: '<End>', type: 'keyToKey', toKeys: '$' },\n { keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },\n { keys: '<PageDown>', type: 'keyToKey', toKeys: '<C-f>' },\n { keys: '<CR>', type: 'keyToKey', toKeys: 'j^', context: 'normal' },\n { keys: '<Ins>', type: 'keyToKey', toKeys: 'i', context: 'normal' },\n { keys: '<Ins>', type: 'action', action: 'toggleOverwrite', context: 'insert' },\n { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true } },\n { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true } },\n { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true } },\n { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false } },\n { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true } },\n { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true } },\n { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true } },\n { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true } },\n { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false } },\n { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false } },\n { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true } },\n { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true } },\n { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true } },\n { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false } },\n { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true } },\n { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true } },\n { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true } },\n { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true } },\n { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true } },\n { keys: '(', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: false } },\n { keys: ')', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: true } },\n { keys: '<C-f>', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true } },\n { keys: '<C-b>', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false } },\n { keys: '<C-d>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true } },\n { keys: '<C-u>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true } },\n { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true } },\n { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true } },\n { keys: \"g$\", type: \"motion\", motion: \"moveToEndOfDisplayLine\" },\n { keys: \"g^\", type: \"motion\", motion: \"moveToStartOfDisplayLine\" },\n { keys: \"g0\", type: \"motion\", motion: \"moveToStartOfDisplayLine\" },\n { keys: '0', type: 'motion', motion: 'moveToStartOfLine' },\n { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar: true } },\n { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar: true } },\n { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar: true, repeatOffset: -1 } },\n { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true } },\n { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true } },\n { keys: 'f<character>', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true, inclusive: true } },\n { keys: 'F<character>', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false } },\n { keys: 't<character>', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true } },\n { keys: 'T<character>', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false } },\n { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true } },\n { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false } },\n { keys: '\\'<character>', type: 'motion', motion: 'goToMark', motionArgs: { toJumplist: true, linewise: true } },\n { keys: '`<character>', type: 'motion', motion: 'goToMark', motionArgs: { toJumplist: true } },\n { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } },\n { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } },\n { keys: ']\\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } },\n { keys: '[\\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } },\n { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true } },\n { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true } },\n { keys: ']<character>', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true } },\n { keys: '[<character>', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true } },\n { keys: '|', type: 'motion', motion: 'moveToColumn' },\n { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context: 'visual' },\n { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: { sameLine: true }, context: 'visual' },\n { keys: 'd', type: 'operator', operator: 'delete' },\n { keys: 'y', type: 'operator', operator: 'yank' },\n { keys: 'c', type: 'operator', operator: 'change' },\n { keys: '=', type: 'operator', operator: 'indentAuto' },\n { keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true } },\n { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false } },\n { keys: 'g~', type: 'operator', operator: 'changeCase' },\n { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: { toLower: true }, isEdit: true },\n { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: { toLower: false }, isEdit: true },\n { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true } },\n { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true } },\n { keys: 'gn', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: true } },\n { keys: 'gN', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: false } },\n { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false } },\n { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true } },\n { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal' },\n { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual' },\n { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'expandToLine', motionArgs: { linewise: true }, context: 'normal' },\n { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual' },\n { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal' },\n { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual' },\n { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal' },\n { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual' },\n { keys: '<C-u>', type: 'operatorMotion', operator: 'delete', motion: 'moveToStartOfLine', context: 'insert' },\n { keys: '<C-w>', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },\n { keys: '<C-w>', type: 'idle', context: 'normal' },\n { keys: '<C-i>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true } },\n { keys: '<C-o>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false } },\n { keys: '<C-e>', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true } },\n { keys: '<C-y>', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true } },\n { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' },\n { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' },\n { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' },\n { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' },\n { keys: 'gi', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'lastEdit' }, context: 'normal' },\n { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank' }, context: 'normal' },\n { keys: 'gI', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'bol' }, context: 'normal' },\n { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' },\n { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' },\n { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' },\n { keys: 'v', type: 'action', action: 'toggleVisualMode' },\n { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true } },\n { keys: '<C-v>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true } },\n { keys: '<C-q>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true } },\n { keys: 'gv', type: 'action', action: 'reselectLastSelection' },\n { keys: 'J', type: 'action', action: 'joinLines', isEdit: true },\n { keys: 'gJ', type: 'action', action: 'joinLines', actionArgs: { keepSpaces: true }, isEdit: true },\n { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true } },\n { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true } },\n { keys: 'r<character>', type: 'action', action: 'replace', isEdit: true },\n { keys: '@<character>', type: 'action', action: 'replayMacro' },\n { keys: 'q<character>', type: 'action', action: 'enterMacroRecordMode' },\n { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }, context: 'normal' },\n { keys: 'R', type: 'operator', operator: 'change', operatorArgs: { linewise: true, fullLine: true }, context: 'visual', exitVisualBlock: true },\n { keys: 'u', type: 'action', action: 'undo', context: 'normal' },\n { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: { toLower: true }, context: 'visual', isEdit: true },\n { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: { toLower: false }, context: 'visual', isEdit: true },\n { keys: '<C-r>', type: 'action', action: 'redo' },\n { keys: 'm<character>', type: 'action', action: 'setMark' },\n { keys: '\"<character>', type: 'action', action: 'setRegister' },\n { keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' } },\n { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' } },\n { keys: 'z<CR>', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' } },\n { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: '.', type: 'action', action: 'repeatLastEdit' },\n { keys: '<C-a>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: { increase: true, backtrack: false } },\n { keys: '<C-x>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: { increase: false, backtrack: false } },\n { keys: '<C-t>', type: 'action', action: 'indent', actionArgs: { indentRight: true }, context: 'insert' },\n { keys: '<C-d>', type: 'action', action: 'indent', actionArgs: { indentRight: false }, context: 'insert' },\n { keys: 'a<character>', type: 'motion', motion: 'textObjectManipulation' },\n { keys: 'i<character>', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true } },\n { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true } },\n { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true } },\n { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true } },\n { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true } },\n { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true } },\n { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true } },\n { keys: ':', type: 'ex' }\n];\nvar defaultKeymapLength = defaultKeymap.length;\nvar defaultExCommandMap = [\n { name: 'colorscheme', shortName: 'colo' },\n { name: 'map' },\n { name: 'imap', shortName: 'im' },\n { name: 'nmap', shortName: 'nm' },\n { name: 'vmap', shortName: 'vm' },\n { name: 'unmap' },\n { name: 'write', shortName: 'w' },\n { name: 'undo', shortName: 'u' },\n { name: 'redo', shortName: 'red' },\n { name: 'set', shortName: 'se' },\n { name: 'setlocal', shortName: 'setl' },\n { name: 'setglobal', shortName: 'setg' },\n { name: 'sort', shortName: 'sor' },\n { name: 'substitute', shortName: 's', possiblyAsync: true },\n { name: 'nohlsearch', shortName: 'noh' },\n { name: 'yank', shortName: 'y' },\n { name: 'delmarks', shortName: 'delm' },\n { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },\n { name: 'vglobal', shortName: 'v' },\n { name: 'global', shortName: 'g' }\n];\nfunction enterVimMode(cm) {\n cm.setOption('disableInput', true);\n cm.setOption('showCursorWhenSelecting', false);\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"normal\" });\n cm.on('cursorActivity', onCursorActivity);\n maybeInitVimState(cm);\n CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm));\n}\nfunction leaveVimMode(cm) {\n cm.setOption('disableInput', false);\n cm.off('cursorActivity', onCursorActivity);\n CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));\n cm.state.vim = null;\n if (highlightTimeout)\n clearTimeout(highlightTimeout);\n}\nfunction detachVimMap(cm, next) {\n if (this == CodeMirror.keyMap.vim) {\n cm.options.$customCursor = null;\n CodeMirror.rmClass(cm.getWrapperElement(), \"cm-fat-cursor\");\n }\n if (!next || next.attach != attachVimMap)\n leaveVimMode(cm);\n}\nfunction attachVimMap(cm, prev) {\n if (this == CodeMirror.keyMap.vim) {\n if (cm.curOp)\n cm.curOp.selectionChanged = true;\n cm.options.$customCursor = transformCursor;\n CodeMirror.addClass(cm.getWrapperElement(), \"cm-fat-cursor\");\n }\n if (!prev || prev.attach != attachVimMap)\n enterVimMode(cm);\n}\nCodeMirror.defineOption('vimMode', false, function (cm, val, prev) {\n if (val && cm.getOption(\"keyMap\") != \"vim\")\n cm.setOption(\"keyMap\", \"vim\");\n else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption(\"keyMap\")))\n cm.setOption(\"keyMap\", \"default\");\n});\nfunction cmKey(key, cm) {\n if (!cm) {\n return undefined;\n }\n if (this[key]) {\n return this[key];\n }\n var vimKey = cmKeyToVimKey(key);\n if (!vimKey) {\n return false;\n }\n var cmd = vimApi.findKey(cm, vimKey);\n if (typeof cmd == 'function') {\n CodeMirror.signal(cm, 'vim-keypress', vimKey);\n }\n return cmd;\n}\nvar modifiers = { Shift: 'S', Ctrl: 'C', Alt: 'A', Cmd: 'D', Mod: 'A', CapsLock: '' };\nvar specialKeys = { Enter: 'CR', Backspace: 'BS', Delete: 'Del', Insert: 'Ins' };\nfunction cmKeyToVimKey(key) {\n if (key.charAt(0) == '\\'') {\n return key.charAt(1);\n }\n var pieces = key.split(/-(?!$)/);\n var lastPiece = pieces[pieces.length - 1];\n if (pieces.length == 1 && pieces[0].length == 1) {\n return false;\n }\n else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) {\n return false;\n }\n var hasCharacter = false;\n for (var i = 0; i < pieces.length; i++) {\n var piece = pieces[i];\n if (piece in modifiers) {\n pieces[i] = modifiers[piece];\n }\n else {\n hasCharacter = true;\n }\n if (piece in specialKeys) {\n pieces[i] = specialKeys[piece];\n }\n }\n if (!hasCharacter) {\n return false;\n }\n if (isUpperCase(lastPiece)) {\n pieces[pieces.length - 1] = lastPiece.toLowerCase();\n }\n return '<' + pieces.join('-') + '>';\n}\nfunction getOnPasteFn(cm) {\n var vim = cm.state.vim;\n if (!vim.onPasteFn) {\n vim.onPasteFn = function () {\n if (!vim.insertMode) {\n cm.setCursor(offsetCursor(cm.getCursor(), 0, 1));\n actions.enterInsertMode(cm, {}, vim);\n }\n };\n }\n return vim.onPasteFn;\n}\nvar numberRegex = /[\\d]/;\nvar wordCharTest = [CodeMirror.isWordChar, function (ch) {\n return ch && !CodeMirror.isWordChar(ch) && !/\\s/.test(ch);\n }], bigWordCharTest = [function (ch) {\n return /\\S/.test(ch);\n }];\nfunction makeKeyRange(start, size) {\n var keys = [];\n for (var i = start; i < start + size; i++) {\n keys.push(String.fromCharCode(i));\n }\n return keys;\n}\nvar upperCaseAlphabet = makeKeyRange(65, 26);\nvar lowerCaseAlphabet = makeKeyRange(97, 26);\nvar numbers = makeKeyRange(48, 10);\nvar validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']);\nvar validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '\"', '.', ':', '_', '/', '+']);\nvar upperCaseChars;\ntry {\n upperCaseChars = new RegExp(\"^[\\\\p{Lu}]$\", \"u\");\n}\ncatch (_) {\n upperCaseChars = /^[A-Z]$/;\n}\nfunction isLine(cm, line) {\n return line >= cm.firstLine() && line <= cm.lastLine();\n}\nfunction isLowerCase(k) {\n return (/^[a-z]$/).test(k);\n}\nfunction isMatchableSymbol(k) {\n return '()[]{}'.indexOf(k) != -1;\n}\nfunction isNumber(k) {\n return numberRegex.test(k);\n}\nfunction isUpperCase(k) {\n return upperCaseChars.test(k);\n}\nfunction isWhiteSpaceString(k) {\n return (/^\\s*$/).test(k);\n}\nfunction isEndOfSentenceSymbol(k) {\n return '.?!'.indexOf(k) != -1;\n}\nfunction inArray(val, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] == val) {\n return true;\n }\n }\n return false;\n}\nvar options = {};\nfunction defineOption(name, defaultValue, type, aliases, callback) {\n if (defaultValue === undefined && !callback) {\n throw Error('defaultValue is required unless callback is provided');\n }\n if (!type) {\n type = 'string';\n }\n options[name] = {\n type: type,\n defaultValue: defaultValue,\n callback: callback\n };\n if (aliases) {\n for (var i = 0; i < aliases.length; i++) {\n options[aliases[i]] = options[name];\n }\n }\n if (defaultValue) {\n setOption(name, defaultValue);\n }\n}\nfunction setOption(name, value, cm, cfg) {\n var option = options[name];\n cfg = cfg || {};\n var scope = cfg.scope;\n if (!option) {\n return new Error('Unknown option: ' + name);\n }\n if (option.type == 'boolean') {\n if (value && value !== true) {\n return new Error('Invalid argument: ' + name + '=' + value);\n }\n else if (value !== false) {\n value = true;\n }\n }\n if (option.callback) {\n if (scope !== 'local') {\n option.callback(value, undefined);\n }\n if (scope !== 'global' && cm) {\n option.callback(value, cm);\n }\n }\n else {\n if (scope !== 'local') {\n option.value = option.type == 'boolean' ? !!value : value;\n }\n if (scope !== 'global' && cm) {\n cm.state.vim.options[name] = { value: value };\n }\n }\n}\nfunction getOption(name, cm, cfg) {\n var option = options[name];\n cfg = cfg || {};\n var scope = cfg.scope;\n if (!option) {\n return new Error('Unknown option: ' + name);\n }\n if (option.callback) {\n var local = cm && option.callback(undefined, cm);\n if (scope !== 'global' && local !== undefined) {\n return local;\n }\n if (scope !== 'local') {\n return option.callback();\n }\n return;\n }\n else {\n var local = (scope !== 'global') && (cm && cm.state.vim.options[name]);\n return (local || (scope !== 'local') && option || {}).value;\n }\n}\ndefineOption('filetype', undefined, 'string', ['ft'], function (name, cm) {\n if (cm === undefined) {\n return;\n }\n if (name === undefined) {\n var mode = cm.getOption('mode');\n return mode == 'null' ? '' : mode;\n }\n else {\n var mode = name == '' ? 'null' : name;\n cm.setOption('mode', mode);\n }\n});\nvar createCircularJumpList = function () {\n var size = 100;\n var pointer = -1;\n var head = 0;\n var tail = 0;\n var buffer = new Array(size);\n function add(cm, oldCur, newCur) {\n var current = pointer % size;\n var curMark = buffer[current];\n function useNextSlot(cursor) {\n var next = ++pointer % size;\n var trashMark = buffer[next];\n if (trashMark) {\n trashMark.clear();\n }\n buffer[next] = cm.setBookmark(cursor);\n }\n if (curMark) {\n var markPos = curMark.find();\n if (markPos && !cursorEqual(markPos, oldCur)) {\n useNextSlot(oldCur);\n }\n }\n else {\n useNextSlot(oldCur);\n }\n useNextSlot(newCur);\n head = pointer;\n tail = pointer - size + 1;\n if (tail < 0) {\n tail = 0;\n }\n }\n function move(cm, offset) {\n pointer += offset;\n if (pointer > head) {\n pointer = head;\n }\n else if (pointer < tail) {\n pointer = tail;\n }\n var mark = buffer[(size + pointer) % size];\n if (mark && !mark.find()) {\n var inc = offset > 0 ? 1 : -1;\n var newCur;\n var oldCur = cm.getCursor();\n do {\n pointer += inc;\n mark = buffer[(size + pointer) % size];\n if (mark &&\n (newCur = mark.find()) &&\n !cursorEqual(oldCur, newCur)) {\n break;\n }\n } while (pointer < head && pointer > tail);\n }\n return mark;\n }\n function find(cm, offset) {\n var oldPointer = pointer;\n var mark = move(cm, offset);\n pointer = oldPointer;\n return mark && mark.find();\n }\n return {\n cachedCursor: undefined,\n add: add,\n find: find,\n move: move\n };\n};\nvar createInsertModeChanges = function (c) {\n if (c) {\n return {\n changes: c.changes,\n expectCursorActivityForChange: c.expectCursorActivityForChange\n };\n }\n return {\n changes: [],\n expectCursorActivityForChange: false\n };\n};\nfunction MacroModeState() {\n this.latestRegister = undefined;\n this.isPlaying = false;\n this.isRecording = false;\n this.replaySearchQueries = [];\n this.onRecordingDone = undefined;\n this.lastInsertModeChanges = createInsertModeChanges();\n}\nMacroModeState.prototype = {\n exitMacroRecordMode: function () {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.onRecordingDone) {\n macroModeState.onRecordingDone(); // close dialog\n }\n macroModeState.onRecordingDone = undefined;\n macroModeState.isRecording = false;\n },\n enterMacroRecordMode: function (cm, registerName) {\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register) {\n register.clear();\n this.latestRegister = registerName;\n if (cm.openDialog) {\n var template = dom('span', { class: 'cm-vim-message' }, 'recording @' + registerName);\n this.onRecordingDone = cm.openDialog(template, null, { bottom: true });\n }\n this.isRecording = true;\n }\n }\n};\nfunction maybeInitVimState(cm) {\n if (!cm.state.vim) {\n cm.state.vim = {\n inputState: new InputState(),\n lastEditInputState: undefined,\n lastEditActionCommand: undefined,\n lastHPos: -1,\n lastHSPos: -1,\n lastMotion: null,\n marks: {},\n insertMode: false,\n insertModeRepeat: undefined,\n visualMode: false,\n visualLine: false,\n visualBlock: false,\n lastSelection: null,\n lastPastedText: null,\n sel: {},\n options: {}\n };\n }\n return cm.state.vim;\n}\nvar vimGlobalState;\nfunction resetVimGlobalState() {\n vimGlobalState = {\n searchQuery: null,\n searchIsReversed: false,\n lastSubstituteReplacePart: undefined,\n jumpList: createCircularJumpList(),\n macroModeState: new MacroModeState,\n lastCharacterSearch: { increment: 0, forward: true, selectedCharacter: '' },\n registerController: new RegisterController({}),\n searchHistoryController: new HistoryController(),\n exCommandHistoryController: new HistoryController()\n };\n for (var optionName in options) {\n var option = options[optionName];\n option.value = option.defaultValue;\n }\n}\nvar lastInsertModeKeyTimer;\nvar vimApi = {\n enterVimMode: enterVimMode,\n leaveVimMode: leaveVimMode,\n buildKeyMap: function () {\n },\n getRegisterController: function () {\n return vimGlobalState.registerController;\n },\n resetVimGlobalState_: resetVimGlobalState,\n getVimGlobalState_: function () {\n return vimGlobalState;\n },\n maybeInitVimState_: maybeInitVimState,\n suppressErrorLogging: false,\n InsertModeKey: InsertModeKey,\n map: function (lhs, rhs, ctx) {\n exCommandDispatcher.map(lhs, rhs, ctx);\n },\n unmap: function (lhs, ctx) {\n return exCommandDispatcher.unmap(lhs, ctx);\n },\n noremap: function (lhs, rhs, ctx) {\n function toCtxArray(ctx) {\n return ctx ? [ctx] : ['normal', 'insert', 'visual'];\n }\n var ctxsToMap = toCtxArray(ctx);\n var actualLength = defaultKeymap.length, origLength = defaultKeymapLength;\n for (var i = actualLength - origLength; i < actualLength && ctxsToMap.length; i++) {\n var mapping = defaultKeymap[i];\n if (mapping.keys == rhs &&\n (!ctx || !mapping.context || mapping.context === ctx) &&\n mapping.type.substr(0, 2) !== 'ex' &&\n mapping.type.substr(0, 3) !== 'key') {\n var newMapping = {};\n for (var key in mapping) {\n newMapping[key] = mapping[key];\n }\n newMapping.keys = lhs;\n if (ctx && !newMapping.context) {\n newMapping.context = ctx;\n }\n this._mapCommand(newMapping);\n var mappedCtxs = toCtxArray(mapping.context);\n ctxsToMap = ctxsToMap.filter(function (el) { return mappedCtxs.indexOf(el) === -1; });\n }\n }\n },\n mapclear: function (ctx) {\n var actualLength = defaultKeymap.length, origLength = defaultKeymapLength;\n var userKeymap = defaultKeymap.slice(0, actualLength - origLength);\n defaultKeymap = defaultKeymap.slice(actualLength - origLength);\n if (ctx) {\n for (var i = userKeymap.length - 1; i >= 0; i--) {\n var mapping = userKeymap[i];\n if (ctx !== mapping.context) {\n if (mapping.context) {\n this._mapCommand(mapping);\n }\n else {\n var contexts = ['normal', 'insert', 'visual'];\n for (var j in contexts) {\n if (contexts[j] !== ctx) {\n var newMapping = {};\n for (var key in mapping) {\n newMapping[key] = mapping[key];\n }\n newMapping.context = contexts[j];\n this._mapCommand(newMapping);\n }\n }\n }\n }\n }\n }\n },\n setOption: setOption,\n getOption: getOption,\n defineOption: defineOption,\n defineEx: function (name, prefix, func) {\n if (!prefix) {\n prefix = name;\n }\n else if (name.indexOf(prefix) !== 0) {\n throw new Error('(Vim.defineEx) \"' + prefix + '\" is not a prefix of \"' + name + '\", command not registered');\n }\n exCommands[name] = func;\n exCommandDispatcher.commandMap_[prefix] = { name: name, shortName: prefix, type: 'api' };\n },\n handleKey: function (cm, key, origin) {\n var command = this.findKey(cm, key, origin);\n if (typeof command === 'function') {\n return command();\n }\n },\n multiSelectHandleKey: multiSelectHandleKey,\n findKey: function (cm, key, origin) {\n var vim = maybeInitVimState(cm);\n function handleMacroRecording() {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isRecording) {\n if (key == 'q') {\n macroModeState.exitMacroRecordMode();\n clearInputState(cm);\n return true;\n }\n if (origin != 'mapping') {\n logKey(macroModeState, key);\n }\n }\n }\n function handleEsc() {\n if (key == '<Esc>') {\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n else if (vim.insertMode) {\n exitInsertMode(cm);\n }\n else {\n return;\n }\n clearInputState(cm);\n return true;\n }\n }\n function doKeyToKey(keys) {\n var match;\n while (keys) {\n match = (/<\\w+-.+?>|<\\w+>|./).exec(keys);\n key = match[0];\n keys = keys.substring(match.index + key.length);\n vimApi.handleKey(cm, key, 'mapping');\n }\n }\n function handleKeyInsertMode() {\n if (handleEsc()) {\n return true;\n }\n var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;\n var keysAreChars = key.length == 1;\n var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');\n while (keys.length > 1 && match.type != 'full') {\n var keys = vim.inputState.keyBuffer = keys.slice(1);\n var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');\n if (thisMatch.type != 'none') {\n match = thisMatch;\n }\n }\n if (match.type == 'none') {\n clearInputState(cm);\n return false;\n }\n else if (match.type == 'partial') {\n if (lastInsertModeKeyTimer) {\n window.clearTimeout(lastInsertModeKeyTimer);\n }\n lastInsertModeKeyTimer = window.setTimeout(function () { if (vim.insertMode && vim.inputState.keyBuffer) {\n clearInputState(cm);\n } }, getOption('insertModeEscKeysTimeout'));\n return !keysAreChars;\n }\n if (lastInsertModeKeyTimer) {\n window.clearTimeout(lastInsertModeKeyTimer);\n }\n if (keysAreChars) {\n var selections = cm.listSelections();\n for (var i = 0; i < selections.length; i++) {\n var here = selections[i].head;\n cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input');\n }\n vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop();\n }\n clearInputState(cm);\n return match.command;\n }\n function handleKeyNonInsertMode() {\n if (handleMacroRecording() || handleEsc()) {\n return true;\n }\n var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;\n if (/^[1-9]\\d*$/.test(keys)) {\n return true;\n }\n var keysMatcher = /^(\\d*)(.*)$/.exec(keys);\n if (!keysMatcher) {\n clearInputState(cm);\n return false;\n }\n var context = vim.visualMode ? 'visual' :\n 'normal';\n var mainKey = keysMatcher[2] || keysMatcher[1];\n if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) {\n mainKey = vim.inputState.operatorShortcut;\n }\n var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context);\n if (match.type == 'none') {\n clearInputState(cm);\n return false;\n }\n else if (match.type == 'partial') {\n return true;\n }\n else if (match.type == 'clear') {\n clearInputState(cm);\n return true;\n }\n vim.inputState.keyBuffer = '';\n keysMatcher = /^(\\d*)(.*)$/.exec(keys);\n if (keysMatcher[1] && keysMatcher[1] != '0') {\n vim.inputState.pushRepeatDigit(keysMatcher[1]);\n }\n return match.command;\n }\n var command;\n if (vim.insertMode) {\n command = handleKeyInsertMode();\n }\n else {\n command = handleKeyNonInsertMode();\n }\n if (command === false) {\n return undefined; //ace_patch\n }\n else if (command === true) {\n return function () { return true; };\n }\n else {\n return function () {\n if ((command.operator || command.isEdit) && cm.getOption('readOnly'))\n return; // ace_patch\n return cm.operation(function () {\n cm.curOp.isVimOp = true;\n try {\n if (command.type == 'keyToKey') {\n doKeyToKey(command.toKeys);\n }\n else {\n commandDispatcher.processCommand(cm, vim, command);\n }\n }\n catch (e) {\n cm.state.vim = undefined;\n maybeInitVimState(cm);\n if (!vimApi.suppressErrorLogging) {\n console['log'](e);\n }\n throw e;\n }\n return true;\n });\n };\n }\n },\n handleEx: function (cm, input) {\n exCommandDispatcher.processCommand(cm, input);\n },\n defineMotion: defineMotion,\n defineAction: defineAction,\n defineOperator: defineOperator,\n mapCommand: mapCommand,\n _mapCommand: _mapCommand,\n defineRegister: defineRegister,\n exitVisualMode: exitVisualMode,\n exitInsertMode: exitInsertMode\n};\nfunction InputState() {\n this.prefixRepeat = [];\n this.motionRepeat = [];\n this.operator = null;\n this.operatorArgs = null;\n this.motion = null;\n this.motionArgs = null;\n this.keyBuffer = []; // For matching multi-key commands.\n this.registerName = null; // Defaults to the unnamed register.\n}\nInputState.prototype.pushRepeatDigit = function (n) {\n if (!this.operator) {\n this.prefixRepeat = this.prefixRepeat.concat(n);\n }\n else {\n this.motionRepeat = this.motionRepeat.concat(n);\n }\n};\nInputState.prototype.getRepeat = function () {\n var repeat = 0;\n if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) {\n repeat = 1;\n if (this.prefixRepeat.length > 0) {\n repeat *= parseInt(this.prefixRepeat.join(''), 10);\n }\n if (this.motionRepeat.length > 0) {\n repeat *= parseInt(this.motionRepeat.join(''), 10);\n }\n }\n return repeat;\n};\nfunction clearInputState(cm, reason) {\n cm.state.vim.inputState = new InputState();\n CodeMirror.signal(cm, 'vim-command-done', reason);\n}\nfunction Register(text, linewise, blockwise) {\n this.clear();\n this.keyBuffer = [text || ''];\n this.insertModeChanges = [];\n this.searchQueries = [];\n this.linewise = !!linewise;\n this.blockwise = !!blockwise;\n}\nRegister.prototype = {\n setText: function (text, linewise, blockwise) {\n this.keyBuffer = [text || ''];\n this.linewise = !!linewise;\n this.blockwise = !!blockwise;\n },\n pushText: function (text, linewise) {\n if (linewise) {\n if (!this.linewise) {\n this.keyBuffer.push('\\n');\n }\n this.linewise = true;\n }\n this.keyBuffer.push(text);\n },\n pushInsertModeChanges: function (changes) {\n this.insertModeChanges.push(createInsertModeChanges(changes));\n },\n pushSearchQuery: function (query) {\n this.searchQueries.push(query);\n },\n clear: function () {\n this.keyBuffer = [];\n this.insertModeChanges = [];\n this.searchQueries = [];\n this.linewise = false;\n },\n toString: function () {\n return this.keyBuffer.join('');\n }\n};\nfunction defineRegister(name, register) {\n var registers = vimGlobalState.registerController.registers;\n if (!name || name.length != 1) {\n throw Error('Register name must be 1 character');\n }\n registers[name] = register;\n validRegisters.push(name);\n}\nfunction RegisterController(registers) {\n this.registers = registers;\n this.unnamedRegister = registers['\"'] = new Register();\n registers['.'] = new Register();\n registers[':'] = new Register();\n registers['/'] = new Register();\n registers['+'] = new Register();\n}\nRegisterController.prototype = {\n pushText: function (registerName, operator, text, linewise, blockwise) {\n if (registerName === '_')\n return;\n if (linewise && text.charAt(text.length - 1) !== '\\n') {\n text += '\\n';\n }\n var register = this.isValidRegister(registerName) ?\n this.getRegister(registerName) : null;\n if (!register) {\n switch (operator) {\n case 'yank':\n this.registers['0'] = new Register(text, linewise, blockwise);\n break;\n case 'delete':\n case 'change':\n if (text.indexOf('\\n') == -1) {\n this.registers['-'] = new Register(text, linewise);\n }\n else {\n this.shiftNumericRegisters_();\n this.registers['1'] = new Register(text, linewise);\n }\n break;\n }\n this.unnamedRegister.setText(text, linewise, blockwise);\n return;\n }\n var append = isUpperCase(registerName);\n if (append) {\n register.pushText(text, linewise);\n }\n else {\n register.setText(text, linewise, blockwise);\n }\n if (registerName === '+' && typeof navigator !== 'undefined' &&\n typeof navigator.clipboard !== 'undefined' &&\n typeof navigator.clipboard.readText === 'function') {\n navigator.clipboard.writeText(text);\n }\n this.unnamedRegister.setText(register.toString(), linewise);\n },\n getRegister: function (name) {\n if (!this.isValidRegister(name)) {\n return this.unnamedRegister;\n }\n name = name.toLowerCase();\n if (!this.registers[name]) {\n this.registers[name] = new Register();\n }\n return this.registers[name];\n },\n isValidRegister: function (name) {\n return name && inArray(name, validRegisters);\n },\n shiftNumericRegisters_: function () {\n for (var i = 9; i >= 2; i--) {\n this.registers[i] = this.getRegister('' + (i - 1));\n }\n }\n};\nfunction HistoryController() {\n this.historyBuffer = [];\n this.iterator = 0;\n this.initialPrefix = null;\n}\nHistoryController.prototype = {\n nextMatch: function (input, up) {\n var historyBuffer = this.historyBuffer;\n var dir = up ? -1 : 1;\n if (this.initialPrefix === null)\n this.initialPrefix = input;\n for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i += dir) {\n var element = historyBuffer[i];\n for (var j = 0; j <= element.length; j++) {\n if (this.initialPrefix == element.substring(0, j)) {\n this.iterator = i;\n return element;\n }\n }\n }\n if (i >= historyBuffer.length) {\n this.iterator = historyBuffer.length;\n return this.initialPrefix;\n }\n if (i < 0)\n return input;\n },\n pushInput: function (input) {\n var index = this.historyBuffer.indexOf(input);\n if (index > -1)\n this.historyBuffer.splice(index, 1);\n if (input.length)\n this.historyBuffer.push(input);\n },\n reset: function () {\n this.initialPrefix = null;\n this.iterator = this.historyBuffer.length;\n }\n};\nvar commandDispatcher = {\n matchCommand: function (keys, keyMap, inputState, context) {\n var matches = commandMatches(keys, keyMap, context, inputState);\n if (!matches.full && !matches.partial) {\n return { type: 'none' };\n }\n else if (!matches.full && matches.partial) {\n return { type: 'partial' };\n }\n var bestMatch;\n for (var i = 0; i < matches.full.length; i++) {\n var match = matches.full[i];\n if (!bestMatch) {\n bestMatch = match;\n }\n }\n if (bestMatch.keys.slice(-11) == '<character>') {\n var character = lastChar(keys);\n if (!character || character.length > 1)\n return { type: 'clear' };\n inputState.selectedCharacter = character;\n }\n return { type: 'full', command: bestMatch };\n },\n processCommand: function (cm, vim, command) {\n vim.inputState.repeatOverride = command.repeatOverride;\n switch (command.type) {\n case 'motion':\n this.processMotion(cm, vim, command);\n break;\n case 'operator':\n this.processOperator(cm, vim, command);\n break;\n case 'operatorMotion':\n this.processOperatorMotion(cm, vim, command);\n break;\n case 'action':\n this.processAction(cm, vim, command);\n break;\n case 'search':\n this.processSearch(cm, vim, command);\n break;\n case 'ex':\n case 'keyToEx':\n this.processEx(cm, vim, command);\n break;\n default:\n break;\n }\n },\n processMotion: function (cm, vim, command) {\n vim.inputState.motion = command.motion;\n vim.inputState.motionArgs = copyArgs(command.motionArgs);\n this.evalInput(cm, vim);\n },\n processOperator: function (cm, vim, command) {\n var inputState = vim.inputState;\n if (inputState.operator) {\n if (inputState.operator == command.operator) {\n inputState.motion = 'expandToLine';\n inputState.motionArgs = { linewise: true };\n this.evalInput(cm, vim);\n return;\n }\n else {\n clearInputState(cm);\n }\n }\n inputState.operator = command.operator;\n inputState.operatorArgs = copyArgs(command.operatorArgs);\n if (command.keys.length > 1) {\n inputState.operatorShortcut = command.keys;\n }\n if (command.exitVisualBlock) {\n vim.visualBlock = false;\n updateCmSelection(cm);\n }\n if (vim.visualMode) {\n this.evalInput(cm, vim);\n }\n },\n processOperatorMotion: function (cm, vim, command) {\n var visualMode = vim.visualMode;\n var operatorMotionArgs = copyArgs(command.operatorMotionArgs);\n if (operatorMotionArgs) {\n if (visualMode && operatorMotionArgs.visualLine) {\n vim.visualLine = true;\n }\n }\n this.processOperator(cm, vim, command);\n if (!visualMode) {\n this.processMotion(cm, vim, command);\n }\n },\n processAction: function (cm, vim, command) {\n var inputState = vim.inputState;\n var repeat = inputState.getRepeat();\n var repeatIsExplicit = !!repeat;\n var actionArgs = copyArgs(command.actionArgs) || {};\n if (inputState.selectedCharacter) {\n actionArgs.selectedCharacter = inputState.selectedCharacter;\n }\n if (command.operator) {\n this.processOperator(cm, vim, command);\n }\n if (command.motion) {\n this.processMotion(cm, vim, command);\n }\n if (command.motion || command.operator) {\n this.evalInput(cm, vim);\n }\n actionArgs.repeat = repeat || 1;\n actionArgs.repeatIsExplicit = repeatIsExplicit;\n actionArgs.registerName = inputState.registerName;\n clearInputState(cm);\n vim.lastMotion = null;\n if (command.isEdit) {\n this.recordLastEdit(vim, inputState, command);\n }\n actions[command.action](cm, actionArgs, vim);\n },\n processSearch: function (cm, vim, command) {\n if (!cm.getSearchCursor) {\n return;\n }\n var forward = command.searchArgs.forward;\n var wholeWordOnly = command.searchArgs.wholeWordOnly;\n getSearchState(cm).setReversed(!forward);\n var promptPrefix = (forward) ? '/' : '?';\n var originalQuery = getSearchState(cm).getQuery();\n var originalScrollPos = cm.getScrollInfo();\n function handleQuery(query, ignoreCase, smartCase) {\n vimGlobalState.searchHistoryController.pushInput(query);\n vimGlobalState.searchHistoryController.reset();\n try {\n updateSearchQuery(cm, query, ignoreCase, smartCase);\n }\n catch (e) {\n showConfirm(cm, 'Invalid regex: ' + query);\n clearInputState(cm);\n return;\n }\n commandDispatcher.processMotion(cm, vim, {\n type: 'motion',\n motion: 'findNext',\n motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist }\n });\n }\n function onPromptClose(query) {\n handleQuery(query, true /** ignoreCase */, true /** smartCase */);\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isRecording) {\n logSearchQuery(macroModeState, query);\n }\n }\n function onPromptKeyUp(e, query, close) {\n var keyName = CodeMirror.keyName(e), up, offset;\n if (keyName == 'Up' || keyName == 'Down') {\n up = keyName == 'Up' ? true : false;\n offset = e.target ? e.target.selectionEnd : 0;\n query = vimGlobalState.searchHistoryController.nextMatch(query, up) || '';\n close(query);\n if (offset && e.target)\n e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length);\n }\n else {\n if (keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')\n vimGlobalState.searchHistoryController.reset();\n }\n var parsedQuery;\n try {\n parsedQuery = updateSearchQuery(cm, query, true /** ignoreCase */, true /** smartCase */);\n }\n catch (e) {\n }\n if (parsedQuery) {\n cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30);\n }\n else {\n clearSearchHighlight(cm);\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n }\n }\n function onPromptKeyDown(e, query, close) {\n var keyName = CodeMirror.keyName(e);\n if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||\n (keyName == 'Backspace' && query == '')) {\n vimGlobalState.searchHistoryController.pushInput(query);\n vimGlobalState.searchHistoryController.reset();\n updateSearchQuery(cm, originalQuery);\n clearSearchHighlight(cm);\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n CodeMirror.e_stop(e);\n clearInputState(cm);\n close();\n cm.focus();\n }\n else if (keyName == 'Up' || keyName == 'Down') {\n CodeMirror.e_stop(e);\n }\n else if (keyName == 'Ctrl-U') {\n CodeMirror.e_stop(e);\n close('');\n }\n }\n switch (command.searchArgs.querySrc) {\n case 'prompt':\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) {\n var query = macroModeState.replaySearchQueries.shift();\n handleQuery(query, true /** ignoreCase */, false /** smartCase */);\n }\n else {\n showPrompt(cm, {\n onClose: onPromptClose,\n prefix: promptPrefix,\n desc: '(JavaScript regexp)',\n onKeyUp: onPromptKeyUp,\n onKeyDown: onPromptKeyDown\n });\n }\n break;\n case 'wordUnderCursor':\n var word = expandWordUnderCursor(cm, false /** inclusive */, true /** forward */, false /** bigWord */, true /** noSymbol */);\n var isKeyword = true;\n if (!word) {\n word = expandWordUnderCursor(cm, false /** inclusive */, true /** forward */, false /** bigWord */, false /** noSymbol */);\n isKeyword = false;\n }\n if (!word) {\n return;\n }\n var query = cm.getLine(word.start.line).substring(word.start.ch, word.end.ch);\n if (isKeyword && wholeWordOnly) {\n query = '\\\\b' + query + '\\\\b';\n }\n else {\n query = escapeRegex(query);\n }\n vimGlobalState.jumpList.cachedCursor = cm.getCursor();\n cm.setCursor(word.start);\n handleQuery(query, true /** ignoreCase */, false /** smartCase */);\n break;\n }\n },\n processEx: function (cm, vim, command) {\n function onPromptClose(input) {\n vimGlobalState.exCommandHistoryController.pushInput(input);\n vimGlobalState.exCommandHistoryController.reset();\n exCommandDispatcher.processCommand(cm, input);\n if (cm.state.vim)\n clearInputState(cm);\n }\n function onPromptKeyDown(e, input, close) {\n var keyName = CodeMirror.keyName(e), up, offset;\n if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||\n (keyName == 'Backspace' && input == '')) {\n vimGlobalState.exCommandHistoryController.pushInput(input);\n vimGlobalState.exCommandHistoryController.reset();\n CodeMirror.e_stop(e);\n clearInputState(cm);\n close();\n cm.focus();\n }\n if (keyName == 'Up' || keyName == 'Down') {\n CodeMirror.e_stop(e);\n up = keyName == 'Up' ? true : false;\n offset = e.target ? e.target.selectionEnd : 0;\n input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || '';\n close(input);\n if (offset && e.target)\n e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length);\n }\n else if (keyName == 'Ctrl-U') {\n CodeMirror.e_stop(e);\n close('');\n }\n else {\n if (keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')\n vimGlobalState.exCommandHistoryController.reset();\n }\n }\n if (command.type == 'keyToEx') {\n exCommandDispatcher.processCommand(cm, command.exArgs.input);\n }\n else {\n if (vim.visualMode) {\n showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\\'<,\\'>',\n onKeyDown: onPromptKeyDown, selectValueOnOpen: false });\n }\n else {\n showPrompt(cm, { onClose: onPromptClose, prefix: ':',\n onKeyDown: onPromptKeyDown });\n }\n }\n },\n evalInput: function (cm, vim) {\n var inputState = vim.inputState;\n var motion = inputState.motion;\n var motionArgs = inputState.motionArgs || {};\n var operator = inputState.operator;\n var operatorArgs = inputState.operatorArgs || {};\n var registerName = inputState.registerName;\n var sel = vim.sel;\n var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head) : cm.getCursor('head'));\n var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor'));\n var oldHead = copyCursor(origHead);\n var oldAnchor = copyCursor(origAnchor);\n var newHead, newAnchor;\n var repeat;\n if (operator) {\n this.recordLastEdit(vim, inputState);\n }\n if (inputState.repeatOverride !== undefined) {\n repeat = inputState.repeatOverride;\n }\n else {\n repeat = inputState.getRepeat();\n }\n if (repeat > 0 && motionArgs.explicitRepeat) {\n motionArgs.repeatIsExplicit = true;\n }\n else if (motionArgs.noRepeat ||\n (!motionArgs.explicitRepeat && repeat === 0)) {\n repeat = 1;\n motionArgs.repeatIsExplicit = false;\n }\n if (inputState.selectedCharacter) {\n motionArgs.selectedCharacter = operatorArgs.selectedCharacter =\n inputState.selectedCharacter;\n }\n motionArgs.repeat = repeat;\n clearInputState(cm);\n if (motion) {\n var motionResult = motions[motion](cm, origHead, motionArgs, vim, inputState);\n vim.lastMotion = motions[motion];\n if (!motionResult) {\n return;\n }\n if (motionArgs.toJumplist) {\n if (!operator && cm.ace.curOp != null)\n cm.ace.curOp.command.scrollIntoView = \"center-animate\"; // ace_patch\n var jumpList = vimGlobalState.jumpList;\n var cachedCursor = jumpList.cachedCursor;\n if (cachedCursor) {\n recordJumpPosition(cm, cachedCursor, motionResult);\n delete jumpList.cachedCursor;\n }\n else {\n recordJumpPosition(cm, origHead, motionResult);\n }\n }\n if (motionResult instanceof Array) {\n newAnchor = motionResult[0];\n newHead = motionResult[1];\n }\n else {\n newHead = motionResult;\n }\n if (!newHead) {\n newHead = copyCursor(origHead);\n }\n if (vim.visualMode) {\n if (!(vim.visualBlock && newHead.ch === Infinity)) {\n newHead = clipCursorToContent(cm, newHead, oldHead);\n }\n if (newAnchor) {\n newAnchor = clipCursorToContent(cm, newAnchor);\n }\n newAnchor = newAnchor || oldAnchor;\n sel.anchor = newAnchor;\n sel.head = newHead;\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorIsBefore(newAnchor, newHead) ? newAnchor\n : newHead);\n updateMark(cm, vim, '>', cursorIsBefore(newAnchor, newHead) ? newHead\n : newAnchor);\n }\n else if (!operator) {\n if (cm.ace.curOp)\n cm.ace.curOp.vimDialogScroll = \"center-animate\"; // ace_patch\n newHead = clipCursorToContent(cm, newHead, oldHead);\n cm.setCursor(newHead.line, newHead.ch);\n }\n }\n if (operator) {\n if (operatorArgs.lastSel) {\n newAnchor = oldAnchor;\n var lastSel = operatorArgs.lastSel;\n var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line);\n var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch);\n if (lastSel.visualLine) {\n newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch);\n }\n else if (lastSel.visualBlock) {\n newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset);\n }\n else if (lastSel.head.line == lastSel.anchor.line) {\n newHead = new Pos(oldAnchor.line, oldAnchor.ch + chOffset);\n }\n else {\n newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch);\n }\n vim.visualMode = true;\n vim.visualLine = lastSel.visualLine;\n vim.visualBlock = lastSel.visualBlock;\n sel = vim.sel = {\n anchor: newAnchor,\n head: newHead\n };\n updateCmSelection(cm);\n }\n else if (vim.visualMode) {\n operatorArgs.lastSel = {\n anchor: copyCursor(sel.anchor),\n head: copyCursor(sel.head),\n visualBlock: vim.visualBlock,\n visualLine: vim.visualLine\n };\n }\n var curStart, curEnd, linewise, mode;\n var cmSel;\n if (vim.visualMode) {\n curStart = cursorMin(sel.head, sel.anchor);\n curEnd = cursorMax(sel.head, sel.anchor);\n linewise = vim.visualLine || operatorArgs.linewise;\n mode = vim.visualBlock ? 'block' :\n linewise ? 'line' :\n 'char';\n var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd);\n cmSel = makeCmSelection(cm, {\n anchor: newPositions.start,\n head: newPositions.end\n }, mode);\n if (linewise) {\n var ranges = cmSel.ranges;\n if (mode == 'block') {\n for (var i = 0; i < ranges.length; i++) {\n ranges[i].head.ch = lineLength(cm, ranges[i].head.line);\n }\n }\n else if (mode == 'line') {\n ranges[0].head = new Pos(ranges[0].head.line + 1, 0);\n }\n }\n }\n else {\n curStart = copyCursor(newAnchor || oldAnchor);\n curEnd = copyCursor(newHead || oldHead);\n if (cursorIsBefore(curEnd, curStart)) {\n var tmp = curStart;\n curStart = curEnd;\n curEnd = tmp;\n }\n linewise = motionArgs.linewise || operatorArgs.linewise;\n if (linewise) {\n expandSelectionToLine(cm, curStart, curEnd);\n }\n else if (motionArgs.forward) {\n clipToLine(cm, curStart, curEnd);\n }\n mode = 'char';\n var exclusive = !motionArgs.inclusive || linewise;\n var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd);\n cmSel = makeCmSelection(cm, {\n anchor: newPositions.start,\n head: newPositions.end\n }, mode, exclusive);\n }\n cm.setSelections(cmSel.ranges, cmSel.primary);\n vim.lastMotion = null;\n operatorArgs.repeat = repeat; // For indent in visual mode.\n operatorArgs.registerName = registerName;\n operatorArgs.linewise = linewise;\n var operatorMoveTo = operators[operator](cm, operatorArgs, cmSel.ranges, oldAnchor, newHead);\n if (vim.visualMode) {\n exitVisualMode(cm, operatorMoveTo != null);\n }\n if (operatorMoveTo) {\n cm.setCursor(operatorMoveTo);\n }\n }\n },\n recordLastEdit: function (vim, inputState, actionCommand) {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) {\n return;\n }\n vim.lastEditInputState = inputState;\n vim.lastEditActionCommand = actionCommand;\n macroModeState.lastInsertModeChanges.changes = [];\n macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false;\n macroModeState.lastInsertModeChanges.visualBlock = vim.visualBlock ? vim.sel.head.line - vim.sel.anchor.line : 0;\n }\n};\nvar motions = {\n moveToTopLine: function (cm, _head, motionArgs) {\n var line = getUserVisibleLines(cm).top + motionArgs.repeat - 1;\n return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n moveToMiddleLine: function (cm) {\n var range = getUserVisibleLines(cm);\n var line = Math.floor((range.top + range.bottom) * 0.5);\n return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n moveToBottomLine: function (cm, _head, motionArgs) {\n var line = getUserVisibleLines(cm).bottom - motionArgs.repeat + 1;\n return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n expandToLine: function (_cm, head, motionArgs) {\n var cur = head;\n return new Pos(cur.line + motionArgs.repeat - 1, Infinity);\n },\n findNext: function (cm, _head, motionArgs) {\n var state = getSearchState(cm);\n var query = state.getQuery();\n if (!query) {\n return;\n }\n var prev = !motionArgs.forward;\n prev = (state.isReversed()) ? !prev : prev;\n highlightSearchMatches(cm, query);\n return findNext(cm, prev /** prev */, query, motionArgs.repeat);\n },\n findAndSelectNextInclusive: function (cm, _head, motionArgs, vim, prevInputState) {\n var state = getSearchState(cm);\n var query = state.getQuery();\n if (!query) {\n return;\n }\n var prev = !motionArgs.forward;\n prev = (state.isReversed()) ? !prev : prev;\n var next = findNextFromAndToInclusive(cm, prev, query, motionArgs.repeat, vim);\n if (!next) {\n return;\n }\n if (prevInputState.operator) {\n return next;\n }\n var from = next[0];\n var to = new Pos(next[1].line, next[1].ch - 1);\n if (vim.visualMode) {\n if (vim.visualLine || vim.visualBlock) {\n vim.visualLine = false;\n vim.visualBlock = false;\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\", subMode: \"\" });\n }\n var anchor = vim.sel.anchor;\n if (anchor) {\n if (state.isReversed()) {\n if (motionArgs.forward) {\n return [anchor, from];\n }\n return [anchor, to];\n }\n else {\n if (motionArgs.forward) {\n return [anchor, to];\n }\n return [anchor, from];\n }\n }\n }\n else {\n vim.visualMode = true;\n vim.visualLine = false;\n vim.visualBlock = false;\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\", subMode: \"\" });\n }\n return prev ? [to, from] : [from, to];\n },\n goToMark: function (cm, _head, motionArgs, vim) {\n var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter);\n if (pos) {\n return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos;\n }\n return null;\n },\n moveToOtherHighlightedEnd: function (cm, _head, motionArgs, vim) {\n if (vim.visualBlock && motionArgs.sameLine) {\n var sel = vim.sel;\n return [\n clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)),\n clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch))\n ];\n }\n else {\n return ([vim.sel.head, vim.sel.anchor]);\n }\n },\n jumpToMark: function (cm, head, motionArgs, vim) {\n var best = head;\n for (var i = 0; i < motionArgs.repeat; i++) {\n var cursor = best;\n for (var key in vim.marks) {\n if (!isLowerCase(key)) {\n continue;\n }\n var mark = vim.marks[key].find();\n var isWrongDirection = (motionArgs.forward) ?\n cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark);\n if (isWrongDirection) {\n continue;\n }\n if (motionArgs.linewise && (mark.line == cursor.line)) {\n continue;\n }\n var equal = cursorEqual(cursor, best);\n var between = (motionArgs.forward) ?\n cursorIsBetween(cursor, mark, best) :\n cursorIsBetween(best, mark, cursor);\n if (equal || between) {\n best = mark;\n }\n }\n }\n if (motionArgs.linewise) {\n best = new Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line)));\n }\n return best;\n },\n moveByCharacters: function (_cm, head, motionArgs) {\n var cur = head;\n var repeat = motionArgs.repeat;\n var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat;\n return new Pos(cur.line, ch);\n },\n moveByLines: function (cm, head, motionArgs, vim) {\n var cur = head;\n var endCh = cur.ch;\n switch (vim.lastMotion) {\n case this.moveByLines:\n case this.moveByDisplayLines:\n case this.moveByScroll:\n case this.moveToColumn:\n case this.moveToEol:\n endCh = vim.lastHPos;\n break;\n default:\n vim.lastHPos = endCh;\n }\n var repeat = motionArgs.repeat + (motionArgs.repeatOffset || 0);\n var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat;\n var first = cm.firstLine();\n var last = cm.lastLine();\n if (line < first && cur.line == first) {\n return this.moveToStartOfLine(cm, head, motionArgs, vim);\n }\n else if (line > last && cur.line == last) {\n return moveToEol(cm, head, motionArgs, vim, true);\n }\n var fold = cm.ace.session.getFoldLine(line);\n if (fold) {\n if (motionArgs.forward) {\n if (line > fold.start.row)\n line = fold.end.row + 1;\n }\n else {\n line = fold.start.row;\n }\n }\n if (motionArgs.toFirstChar) {\n endCh = findFirstNonWhiteSpaceCharacter(cm.getLine(line));\n vim.lastHPos = endCh;\n }\n vim.lastHSPos = cm.charCoords(new Pos(line, endCh), 'div').left;\n return new Pos(line, endCh);\n },\n moveByDisplayLines: function (cm, head, motionArgs, vim) {\n var cur = head;\n switch (vim.lastMotion) {\n case this.moveByDisplayLines:\n case this.moveByScroll:\n case this.moveByLines:\n case this.moveToColumn:\n case this.moveToEol:\n break;\n default:\n vim.lastHSPos = cm.charCoords(cur, 'div').left;\n }\n var repeat = motionArgs.repeat;\n var res = cm.findPosV(cur, (motionArgs.forward ? repeat : -repeat), 'line', vim.lastHSPos);\n if (res.hitSide) {\n if (motionArgs.forward) {\n var lastCharCoords = cm.charCoords(res, 'div');\n var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos };\n var res = cm.coordsChar(goalCoords, 'div');\n }\n else {\n var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div');\n resCoords.left = vim.lastHSPos;\n res = cm.coordsChar(resCoords, 'div');\n }\n }\n vim.lastHPos = res.ch;\n return res;\n },\n moveByPage: function (cm, head, motionArgs) {\n var curStart = head;\n var repeat = motionArgs.repeat;\n return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page');\n },\n moveByParagraph: function (cm, head, motionArgs) {\n var dir = motionArgs.forward ? 1 : -1;\n return findParagraph(cm, head, motionArgs.repeat, dir);\n },\n moveBySentence: function (cm, head, motionArgs) {\n var dir = motionArgs.forward ? 1 : -1;\n return findSentence(cm, head, motionArgs.repeat, dir);\n },\n moveByScroll: function (cm, head, motionArgs, vim) {\n var scrollbox = cm.getScrollInfo();\n var curEnd = null;\n var repeat = motionArgs.repeat;\n if (!repeat) {\n repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight());\n }\n var orig = cm.charCoords(head, 'local');\n motionArgs.repeat = repeat;\n curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim);\n if (!curEnd) {\n return null;\n }\n var dest = cm.charCoords(curEnd, 'local');\n cm.scrollTo(null, scrollbox.top + dest.top - orig.top);\n return curEnd;\n },\n moveByWords: function (cm, head, motionArgs) {\n return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward, !!motionArgs.wordEnd, !!motionArgs.bigWord);\n },\n moveTillCharacter: function (cm, _head, motionArgs) {\n var repeat = motionArgs.repeat;\n var curEnd = moveToCharacter(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter);\n var increment = motionArgs.forward ? -1 : 1;\n recordLastCharacterSearch(increment, motionArgs);\n if (!curEnd)\n return null;\n curEnd.ch += increment;\n return curEnd;\n },\n moveToCharacter: function (cm, head, motionArgs) {\n var repeat = motionArgs.repeat;\n recordLastCharacterSearch(0, motionArgs);\n return moveToCharacter(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter) || head;\n },\n moveToSymbol: function (cm, head, motionArgs) {\n var repeat = motionArgs.repeat;\n return findSymbol(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter) || head;\n },\n moveToColumn: function (cm, head, motionArgs, vim) {\n var repeat = motionArgs.repeat;\n vim.lastHPos = repeat - 1;\n vim.lastHSPos = cm.charCoords(head, 'div').left;\n return moveToColumn(cm, repeat);\n },\n moveToEol: function (cm, head, motionArgs, vim) {\n return moveToEol(cm, head, motionArgs, vim, false);\n },\n moveToFirstNonWhiteSpaceCharacter: function (cm, head) {\n var cursor = head;\n return new Pos(cursor.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line)));\n },\n moveToMatchedSymbol: function (cm, head) {\n var cursor = head;\n var line = cursor.line;\n var ch = cursor.ch;\n var lineText = cm.getLine(line);\n var symbol;\n for (; ch < lineText.length; ch++) {\n symbol = lineText.charAt(ch);\n if (symbol && isMatchableSymbol(symbol)) {\n var style = cm.getTokenTypeAt(new Pos(line, ch + 1));\n if (style !== \"string\" && style !== \"comment\") {\n break;\n }\n }\n }\n if (ch < lineText.length) {\n var re = /[<>]/.test(lineText[ch]) ? /[(){}[\\]<>]/ : /[(){}[\\]]/; //ace_patch?\n var matched = cm.findMatchingBracket(new Pos(line, ch + 1), { bracketRegex: re });\n return matched.to;\n }\n else {\n return cursor;\n }\n },\n moveToStartOfLine: function (_cm, head) {\n return new Pos(head.line, 0);\n },\n moveToLineOrEdgeOfDocument: function (cm, _head, motionArgs) {\n var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine();\n if (motionArgs.repeatIsExplicit) {\n lineNum = motionArgs.repeat - cm.getOption('firstLineNumber');\n }\n return new Pos(lineNum, findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum)));\n },\n moveToStartOfDisplayLine: function (cm) {\n cm.execCommand(\"goLineLeft\");\n return cm.getCursor();\n },\n moveToEndOfDisplayLine: function (cm) {\n cm.execCommand(\"goLineRight\");\n var head = cm.getCursor();\n if (head.sticky == \"before\")\n head.ch--;\n return head;\n },\n textObjectManipulation: function (cm, head, motionArgs, vim) {\n var mirroredPairs = { '(': ')', ')': '(',\n '{': '}', '}': '{',\n '[': ']', ']': '[',\n '<': '>', '>': '<' };\n var selfPaired = { '\\'': true, '\"': true, '`': true };\n var character = motionArgs.selectedCharacter;\n if (character == 'b') {\n character = '(';\n }\n else if (character == 'B') {\n character = '{';\n }\n var inclusive = !motionArgs.textObjectInner;\n var tmp;\n if (mirroredPairs[character]) {\n tmp = selectCompanionObject(cm, head, character, inclusive);\n }\n else if (selfPaired[character]) {\n tmp = findBeginningAndEnd(cm, head, character, inclusive);\n }\n else if (character === 'W') {\n tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, true /** bigWord */);\n }\n else if (character === 'w') {\n tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, false /** bigWord */);\n }\n else if (character === 'p') {\n tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive);\n motionArgs.linewise = true;\n if (vim.visualMode) {\n if (!vim.visualLine) {\n vim.visualLine = true;\n }\n }\n else {\n var operatorArgs = vim.inputState.operatorArgs;\n if (operatorArgs) {\n operatorArgs.linewise = true;\n }\n tmp.end.line--;\n }\n }\n else if (character === 't') {\n tmp = expandTagUnderCursor(cm, head, inclusive);\n }\n else if (character === 's') {\n var content = cm.getLine(head.line);\n if (head.ch > 0 && isEndOfSentenceSymbol(content[head.ch])) {\n head.ch -= 1;\n }\n var end = getSentence(cm, head, motionArgs.repeat, 1, inclusive);\n var start = getSentence(cm, head, motionArgs.repeat, -1, inclusive);\n if (isWhiteSpaceString(cm.getLine(start.line)[start.ch])\n && isWhiteSpaceString(cm.getLine(end.line)[end.ch - 1])) {\n start = { line: start.line, ch: start.ch + 1 };\n }\n tmp = { start: start, end: end };\n }\n else {\n return null;\n }\n if (!cm.state.vim.visualMode) {\n return [tmp.start, tmp.end];\n }\n else {\n return expandSelection(cm, tmp.start, tmp.end);\n }\n },\n repeatLastCharacterSearch: function (cm, head, motionArgs) {\n var lastSearch = vimGlobalState.lastCharacterSearch;\n var repeat = motionArgs.repeat;\n var forward = motionArgs.forward === lastSearch.forward;\n var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1);\n cm.moveH(-increment, 'char');\n motionArgs.inclusive = forward ? true : false;\n var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter);\n if (!curEnd) {\n cm.moveH(increment, 'char');\n return head;\n }\n curEnd.ch += increment;\n return curEnd;\n }\n};\nfunction defineMotion(name, fn) {\n motions[name] = fn;\n}\nfunction fillArray(val, times) {\n var arr = [];\n for (var i = 0; i < times; i++) {\n arr.push(val);\n }\n return arr;\n}\nvar operators = {\n change: function (cm, args, ranges) {\n var finalHead, text;\n var vim = cm.state.vim;\n var anchor = ranges[0].anchor, head = ranges[0].head;\n if (!vim.visualMode) {\n text = cm.getRange(anchor, head);\n var lastState = vim.lastEditInputState || {};\n if (lastState.motion == \"moveByWords\" && !isWhiteSpaceString(text)) {\n var match = (/\\s+$/).exec(text);\n if (match && lastState.motionArgs && lastState.motionArgs.forward) {\n head = offsetCursor(head, 0, -match[0].length);\n text = text.slice(0, -match[0].length);\n }\n }\n var prevLineEnd = new Pos(anchor.line - 1, Number.MAX_VALUE);\n var wasLastLine = cm.firstLine() == cm.lastLine();\n if (head.line > cm.lastLine() && args.linewise && !wasLastLine) {\n cm.replaceRange('', prevLineEnd, head);\n }\n else {\n cm.replaceRange('', anchor, head);\n }\n if (args.linewise) {\n if (!wasLastLine) {\n cm.setCursor(prevLineEnd);\n CodeMirror.commands.newlineAndIndent(cm);\n }\n anchor.ch = Number.MAX_VALUE;\n }\n finalHead = anchor;\n }\n else if (args.fullLine) {\n head.ch = Number.MAX_VALUE;\n head.line--;\n cm.setSelection(anchor, head);\n text = cm.getSelection();\n cm.replaceSelection(\"\");\n finalHead = anchor;\n }\n else {\n text = cm.getSelection();\n var replacement = fillArray('', ranges.length);\n cm.replaceSelections(replacement);\n finalHead = cursorMin(ranges[0].head, ranges[0].anchor);\n }\n vimGlobalState.registerController.pushText(args.registerName, 'change', text, args.linewise, ranges.length > 1);\n actions.enterInsertMode(cm, { head: finalHead }, cm.state.vim);\n },\n 'delete': function (cm, args, ranges) {\n var finalHead, text;\n var vim = cm.state.vim;\n if (!vim.visualBlock) {\n var anchor = ranges[0].anchor, head = ranges[0].head;\n if (args.linewise &&\n head.line != cm.firstLine() &&\n anchor.line == cm.lastLine() &&\n anchor.line == head.line - 1) {\n if (anchor.line == cm.firstLine()) {\n anchor.ch = 0;\n }\n else {\n anchor = new Pos(anchor.line - 1, lineLength(cm, anchor.line - 1));\n }\n }\n text = cm.getRange(anchor, head);\n cm.replaceRange('', anchor, head);\n finalHead = anchor;\n if (args.linewise) {\n finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor);\n }\n }\n else {\n text = cm.getSelection();\n var replacement = fillArray('', ranges.length);\n cm.replaceSelections(replacement);\n finalHead = cursorMin(ranges[0].head, ranges[0].anchor);\n }\n vimGlobalState.registerController.pushText(args.registerName, 'delete', text, args.linewise, vim.visualBlock);\n return clipCursorToContent(cm, finalHead);\n },\n indent: function (cm, args, ranges) {\n var vim = cm.state.vim;\n if (cm.indentMore) {\n var repeat = (vim.visualMode) ? args.repeat : 1;\n for (var j = 0; j < repeat; j++) {\n if (args.indentRight)\n cm.indentMore();\n else\n cm.indentLess();\n }\n }\n else {\n var startLine = ranges[0].anchor.line;\n var endLine = vim.visualBlock ?\n ranges[ranges.length - 1].anchor.line :\n ranges[0].head.line;\n var repeat = (vim.visualMode) ? args.repeat : 1;\n if (args.linewise) {\n endLine--;\n }\n for (var i = startLine; i <= endLine; i++) {\n for (var j = 0; j < repeat; j++) {\n cm.indentLine(i, args.indentRight);\n }\n }\n }\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);\n },\n indentAuto: function (cm, _args, ranges) {\n if (ranges.length > 1) { // ace_patch\n cm.setSelection(ranges[0].anchor, ranges[ranges.length - 1].head);\n }\n cm.execCommand(\"indentAuto\");\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);\n },\n changeCase: function (cm, args, ranges, oldAnchor, newHead) {\n var selections = cm.getSelections();\n var swapped = [];\n var toLower = args.toLower;\n for (var j = 0; j < selections.length; j++) {\n var toSwap = selections[j];\n var text = '';\n if (toLower === true) {\n text = toSwap.toLowerCase();\n }\n else if (toLower === false) {\n text = toSwap.toUpperCase();\n }\n else {\n for (var i = 0; i < toSwap.length; i++) {\n var character = toSwap.charAt(i);\n text += isUpperCase(character) ? character.toLowerCase() :\n character.toUpperCase();\n }\n }\n swapped.push(text);\n }\n cm.replaceSelections(swapped);\n if (args.shouldMoveCursor) {\n return newHead;\n }\n else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) {\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor);\n }\n else if (args.linewise) {\n return oldAnchor;\n }\n else {\n return cursorMin(ranges[0].anchor, ranges[0].head);\n }\n },\n yank: function (cm, args, ranges, oldAnchor) {\n var vim = cm.state.vim;\n var text = cm.getSelection();\n var endPos = vim.visualMode\n ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor)\n : oldAnchor;\n vimGlobalState.registerController.pushText(args.registerName, 'yank', text, args.linewise, vim.visualBlock);\n return endPos;\n }\n};\nfunction defineOperator(name, fn) {\n operators[name] = fn;\n}\nvar actions = {\n jumpListWalk: function (cm, actionArgs, vim) {\n if (vim.visualMode) {\n return;\n }\n var repeat = actionArgs.repeat;\n var forward = actionArgs.forward;\n var jumpList = vimGlobalState.jumpList;\n var mark = jumpList.move(cm, forward ? repeat : -repeat);\n var markPos = mark ? mark.find() : undefined;\n markPos = markPos ? markPos : cm.getCursor();\n cm.setCursor(markPos);\n cm.ace.curOp.command.scrollIntoView = \"center-animate\"; // ace_patch\n },\n scroll: function (cm, actionArgs, vim) {\n if (vim.visualMode) {\n return;\n }\n var repeat = actionArgs.repeat || 1;\n var lineHeight = cm.defaultTextHeight();\n var top = cm.getScrollInfo().top;\n var delta = lineHeight * repeat;\n var newPos = actionArgs.forward ? top + delta : top - delta;\n var cursor = copyCursor(cm.getCursor());\n var cursorCoords = cm.charCoords(cursor, 'local');\n if (actionArgs.forward) {\n if (newPos > cursorCoords.top) {\n cursor.line += (newPos - cursorCoords.top) / lineHeight;\n cursor.line = Math.ceil(cursor.line);\n cm.setCursor(cursor);\n cursorCoords = cm.charCoords(cursor, 'local');\n cm.scrollTo(null, cursorCoords.top);\n }\n else {\n cm.scrollTo(null, newPos);\n }\n }\n else {\n var newBottom = newPos + cm.getScrollInfo().clientHeight;\n if (newBottom < cursorCoords.bottom) {\n cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight;\n cursor.line = Math.floor(cursor.line);\n cm.setCursor(cursor);\n cursorCoords = cm.charCoords(cursor, 'local');\n cm.scrollTo(null, cursorCoords.bottom - cm.getScrollInfo().clientHeight);\n }\n else {\n cm.scrollTo(null, newPos);\n }\n }\n },\n scrollToCursor: function (cm, actionArgs) {\n var lineNum = cm.getCursor().line;\n var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local');\n var height = cm.getScrollInfo().clientHeight;\n var y = charCoords.top;\n switch (actionArgs.position) {\n case 'center':\n y = charCoords.bottom - height / 2;\n break;\n case 'bottom':\n var lineLastCharPos = new Pos(lineNum, cm.getLine(lineNum).length - 1);\n var lineLastCharCoords = cm.charCoords(lineLastCharPos, 'local');\n var lineHeight = lineLastCharCoords.bottom - y;\n y = y - height + lineHeight;\n break;\n }\n cm.scrollTo(null, y);\n },\n replayMacro: function (cm, actionArgs, vim) {\n var registerName = actionArgs.selectedCharacter;\n var repeat = actionArgs.repeat;\n var macroModeState = vimGlobalState.macroModeState;\n if (registerName == '@') {\n registerName = macroModeState.latestRegister;\n }\n else {\n macroModeState.latestRegister = registerName;\n }\n while (repeat--) {\n executeMacroRegister(cm, vim, macroModeState, registerName);\n }\n },\n enterMacroRecordMode: function (cm, actionArgs) {\n var macroModeState = vimGlobalState.macroModeState;\n var registerName = actionArgs.selectedCharacter;\n if (vimGlobalState.registerController.isValidRegister(registerName)) {\n macroModeState.enterMacroRecordMode(cm, registerName);\n }\n },\n toggleOverwrite: function (cm) {\n if (!cm.state.overwrite) {\n cm.toggleOverwrite(true);\n cm.setOption('keyMap', 'vim-replace');\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"replace\" });\n }\n else {\n cm.toggleOverwrite(false);\n cm.setOption('keyMap', 'vim-insert');\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"insert\" });\n }\n },\n enterInsertMode: function (cm, actionArgs, vim) {\n if (cm.getOption('readOnly')) {\n return;\n }\n vim.insertMode = true;\n vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1;\n var insertAt = (actionArgs) ? actionArgs.insertAt : null;\n var sel = vim.sel;\n var head = actionArgs.head || cm.getCursor('head');\n var height = cm.listSelections().length;\n if (insertAt == 'eol') {\n head = new Pos(head.line, lineLength(cm, head.line));\n }\n else if (insertAt == 'bol') {\n head = new Pos(head.line, 0);\n }\n else if (insertAt == 'charAfter') {\n var newPosition = updateSelectionForSurrogateCharacters(cm, head, offsetCursor(head, 0, 1));\n head = newPosition.end;\n }\n else if (insertAt == 'firstNonBlank') {\n var newPosition = updateSelectionForSurrogateCharacters(cm, head, motions.moveToFirstNonWhiteSpaceCharacter(cm, head));\n head = newPosition.end;\n }\n else if (insertAt == 'startOfSelectedArea') {\n if (!vim.visualMode)\n return;\n if (!vim.visualBlock) {\n if (sel.head.line < sel.anchor.line) {\n head = sel.head;\n }\n else {\n head = new Pos(sel.anchor.line, 0);\n }\n }\n else {\n head = new Pos(Math.min(sel.head.line, sel.anchor.line), Math.min(sel.head.ch, sel.anchor.ch));\n height = Math.abs(sel.head.line - sel.anchor.line) + 1;\n }\n }\n else if (insertAt == 'endOfSelectedArea') {\n if (!vim.visualMode)\n return;\n if (!vim.visualBlock) {\n if (sel.head.line >= sel.anchor.line) {\n head = offsetCursor(sel.head, 0, 1);\n }\n else {\n head = new Pos(sel.anchor.line, 0);\n }\n }\n else {\n head = new Pos(Math.min(sel.head.line, sel.anchor.line), Math.max(sel.head.ch, sel.anchor.ch) + 1);\n height = Math.abs(sel.head.line - sel.anchor.line) + 1;\n }\n }\n else if (insertAt == 'inplace') {\n if (vim.visualMode) {\n return;\n }\n }\n else if (insertAt == 'lastEdit') {\n head = getLastEditPos(cm) || head;\n }\n cm.setOption('disableInput', false);\n if (actionArgs && actionArgs.replace) {\n cm.toggleOverwrite(true);\n cm.setOption('keyMap', 'vim-replace');\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"replace\" });\n }\n else {\n cm.toggleOverwrite(false);\n cm.setOption('keyMap', 'vim-insert');\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"insert\" });\n }\n if (!vimGlobalState.macroModeState.isPlaying) {\n cm.on('change', onChange);\n CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);\n }\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n selectForInsert(cm, head, height);\n },\n toggleVisualMode: function (cm, actionArgs, vim) {\n var repeat = actionArgs.repeat;\n var anchor = cm.getCursor();\n var head;\n if (!vim.visualMode) {\n vim.visualMode = true;\n vim.visualLine = !!actionArgs.linewise;\n vim.visualBlock = !!actionArgs.blockwise;\n head = clipCursorToContent(cm, new Pos(anchor.line, anchor.ch + repeat - 1));\n var newPosition = updateSelectionForSurrogateCharacters(cm, anchor, head);\n vim.sel = {\n anchor: newPosition.start,\n head: newPosition.end\n };\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\", subMode: vim.visualLine ? \"linewise\" : vim.visualBlock ? \"blockwise\" : \"\" });\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorMin(anchor, head));\n updateMark(cm, vim, '>', cursorMax(anchor, head));\n }\n else if (vim.visualLine ^ actionArgs.linewise ||\n vim.visualBlock ^ actionArgs.blockwise) {\n vim.visualLine = !!actionArgs.linewise;\n vim.visualBlock = !!actionArgs.blockwise;\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\", subMode: vim.visualLine ? \"linewise\" : vim.visualBlock ? \"blockwise\" : \"\" });\n updateCmSelection(cm);\n }\n else {\n exitVisualMode(cm);\n }\n },\n reselectLastSelection: function (cm, _actionArgs, vim) {\n var lastSelection = vim.lastSelection;\n if (vim.visualMode) {\n updateLastSelection(cm, vim);\n }\n if (lastSelection) {\n var anchor = lastSelection.anchorMark.find();\n var head = lastSelection.headMark.find();\n if (!anchor || !head) {\n return;\n }\n vim.sel = {\n anchor: anchor,\n head: head\n };\n vim.visualMode = true;\n vim.visualLine = lastSelection.visualLine;\n vim.visualBlock = lastSelection.visualBlock;\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorMin(anchor, head));\n updateMark(cm, vim, '>', cursorMax(anchor, head));\n CodeMirror.signal(cm, 'vim-mode-change', {\n mode: 'visual',\n subMode: vim.visualLine ? 'linewise' :\n vim.visualBlock ? 'blockwise' : ''\n });\n }\n },\n joinLines: function (cm, actionArgs, vim) {\n var curStart, curEnd;\n if (vim.visualMode) {\n curStart = cm.getCursor('anchor');\n curEnd = cm.getCursor('head');\n if (cursorIsBefore(curEnd, curStart)) {\n var tmp = curEnd;\n curEnd = curStart;\n curStart = tmp;\n }\n curEnd.ch = lineLength(cm, curEnd.line) - 1;\n }\n else {\n var repeat = Math.max(actionArgs.repeat, 2);\n curStart = cm.getCursor();\n curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1, Infinity));\n }\n var finalCh = 0;\n for (var i = curStart.line; i < curEnd.line; i++) {\n finalCh = lineLength(cm, curStart.line);\n var text = '';\n var nextStartCh = 0;\n if (!actionArgs.keepSpaces) {\n var nextLine = cm.getLine(curStart.line + 1);\n nextStartCh = nextLine.search(/\\S/);\n if (nextStartCh == -1) {\n nextStartCh = nextLine.length;\n }\n else {\n text = \" \";\n }\n }\n cm.replaceRange(text, new Pos(curStart.line, finalCh), new Pos(curStart.line + 1, nextStartCh));\n }\n var curFinalPos = clipCursorToContent(cm, new Pos(curStart.line, finalCh));\n if (vim.visualMode) {\n exitVisualMode(cm, false);\n }\n cm.setCursor(curFinalPos);\n },\n newLineAndEnterInsertMode: function (cm, actionArgs, vim) {\n vim.insertMode = true;\n var insertAt = copyCursor(cm.getCursor());\n if (insertAt.line === cm.firstLine() && !actionArgs.after) {\n cm.replaceRange('\\n', new Pos(cm.firstLine(), 0));\n cm.setCursor(cm.firstLine(), 0);\n }\n else {\n insertAt.line = (actionArgs.after) ? insertAt.line :\n insertAt.line - 1;\n insertAt.ch = lineLength(cm, insertAt.line);\n cm.setCursor(insertAt);\n var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment ||\n CodeMirror.commands.newlineAndIndent;\n newlineFn(cm);\n }\n this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim);\n },\n paste: function (cm, actionArgs, vim) {\n var _this = this;\n var register = vimGlobalState.registerController.getRegister(actionArgs.registerName);\n var fallback = function () {\n var text = register.toString();\n _this.continuePaste(cm, actionArgs, vim, text, register);\n };\n if (actionArgs.registerName === '+' &&\n typeof navigator !== 'undefined' &&\n typeof navigator.clipboard !== 'undefined' &&\n typeof navigator.clipboard.readText === 'function') {\n navigator.clipboard.readText().then(function (value) {\n _this.continuePaste(cm, actionArgs, vim, value, register);\n }, function () { fallback(); });\n }\n else {\n fallback();\n }\n },\n continuePaste: function (cm, actionArgs, vim, text, register) {\n var cur = copyCursor(cm.getCursor());\n if (!text) {\n return;\n }\n if (actionArgs.matchIndent) {\n var tabSize = cm.getOption(\"tabSize\");\n var whitespaceLength = function (str) {\n var tabs = (str.split(\"\\t\").length - 1);\n var spaces = (str.split(\" \").length - 1);\n return tabs * tabSize + spaces * 1;\n };\n var currentLine = cm.getLine(cm.getCursor().line);\n var indent = whitespaceLength(currentLine.match(/^\\s*/)[0]);\n var chompedText = text.replace(/\\n$/, '');\n var wasChomped = text !== chompedText;\n var firstIndent = whitespaceLength(text.match(/^\\s*/)[0]);\n var text = chompedText.replace(/^\\s*/gm, function (wspace) {\n var newIndent = indent + (whitespaceLength(wspace) - firstIndent);\n if (newIndent < 0) {\n return \"\";\n }\n else if (cm.getOption(\"indentWithTabs\")) {\n var quotient = Math.floor(newIndent / tabSize);\n return Array(quotient + 1).join('\\t');\n }\n else {\n return Array(newIndent + 1).join(' ');\n }\n });\n text += wasChomped ? \"\\n\" : \"\";\n }\n if (actionArgs.repeat > 1) {\n var text = Array(actionArgs.repeat + 1).join(text);\n }\n var linewise = register.linewise;\n var blockwise = register.blockwise;\n if (blockwise) {\n text = text.split('\\n');\n if (linewise) {\n text.pop();\n }\n for (var i = 0; i < text.length; i++) {\n text[i] = (text[i] == '') ? ' ' : text[i];\n }\n cur.ch += actionArgs.after ? 1 : 0;\n cur.ch = Math.min(lineLength(cm, cur.line), cur.ch);\n }\n else if (linewise) {\n if (vim.visualMode) {\n text = vim.visualLine ? text.slice(0, -1) : '\\n' + text.slice(0, text.length - 1) + '\\n';\n }\n else if (actionArgs.after) {\n text = '\\n' + text.slice(0, text.length - 1);\n cur.ch = lineLength(cm, cur.line);\n }\n else {\n cur.ch = 0;\n }\n }\n else {\n cur.ch += actionArgs.after ? 1 : 0;\n }\n var curPosFinal;\n var idx;\n if (vim.visualMode) {\n vim.lastPastedText = text;\n var lastSelectionCurEnd;\n var selectedArea = getSelectedAreaRange(cm, vim);\n var selectionStart = selectedArea[0];\n var selectionEnd = selectedArea[1];\n var selectedText = cm.getSelection();\n var selections = cm.listSelections();\n var emptyStrings = new Array(selections.length).join('1').split('1');\n if (vim.lastSelection) {\n lastSelectionCurEnd = vim.lastSelection.headMark.find();\n }\n vimGlobalState.registerController.unnamedRegister.setText(selectedText);\n if (blockwise) {\n cm.replaceSelections(emptyStrings);\n selectionEnd = new Pos(selectionStart.line + text.length - 1, selectionStart.ch);\n cm.setCursor(selectionStart);\n selectBlock(cm, selectionEnd);\n cm.replaceSelections(text);\n curPosFinal = selectionStart;\n }\n else if (vim.visualBlock) {\n cm.replaceSelections(emptyStrings);\n cm.setCursor(selectionStart);\n cm.replaceRange(text, selectionStart, selectionStart);\n curPosFinal = selectionStart;\n }\n else {\n cm.replaceRange(text, selectionStart, selectionEnd);\n curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1);\n }\n if (lastSelectionCurEnd) {\n vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd);\n }\n if (linewise) {\n curPosFinal.ch = 0;\n }\n }\n else {\n if (blockwise) {\n cm.setCursor(cur);\n for (var i = 0; i < text.length; i++) {\n var line = cur.line + i;\n if (line > cm.lastLine()) {\n cm.replaceRange('\\n', new Pos(line, 0));\n }\n var lastCh = lineLength(cm, line);\n if (lastCh < cur.ch) {\n extendLineToColumn(cm, line, cur.ch);\n }\n }\n cm.setCursor(cur);\n selectBlock(cm, new Pos(cur.line + text.length - 1, cur.ch));\n cm.replaceSelections(text);\n curPosFinal = cur;\n }\n else {\n cm.replaceRange(text, cur);\n if (linewise && actionArgs.after) {\n curPosFinal = new Pos(cur.line + 1, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1)));\n }\n else if (linewise && !actionArgs.after) {\n curPosFinal = new Pos(cur.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line)));\n }\n else if (!linewise && actionArgs.after) {\n idx = cm.indexFromPos(cur);\n curPosFinal = cm.posFromIndex(idx + text.length - 1);\n }\n else {\n idx = cm.indexFromPos(cur);\n curPosFinal = cm.posFromIndex(idx + text.length);\n }\n }\n }\n if (vim.visualMode) {\n exitVisualMode(cm, false);\n }\n cm.setCursor(curPosFinal);\n },\n undo: function (cm, actionArgs) {\n cm.operation(function () {\n repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)();\n cm.setCursor(clipCursorToContent(cm, cm.getCursor('start')));\n });\n },\n redo: function (cm, actionArgs) {\n repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)();\n },\n setRegister: function (_cm, actionArgs, vim) {\n vim.inputState.registerName = actionArgs.selectedCharacter;\n },\n setMark: function (cm, actionArgs, vim) {\n var markName = actionArgs.selectedCharacter;\n updateMark(cm, vim, markName, cm.getCursor());\n },\n replace: function (cm, actionArgs, vim) {\n var replaceWith = actionArgs.selectedCharacter;\n var curStart = cm.getCursor();\n var replaceTo;\n var curEnd;\n var selections = cm.listSelections();\n if (vim.visualMode) {\n curStart = cm.getCursor('start');\n curEnd = cm.getCursor('end');\n }\n else {\n var line = cm.getLine(curStart.line);\n replaceTo = curStart.ch + actionArgs.repeat;\n if (replaceTo > line.length) {\n replaceTo = line.length;\n }\n curEnd = new Pos(curStart.line, replaceTo);\n }\n var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd);\n curStart = newPositions.start;\n curEnd = newPositions.end;\n if (replaceWith == '\\n') {\n if (!vim.visualMode)\n cm.replaceRange('', curStart, curEnd);\n (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm);\n }\n else {\n var replaceWithStr = cm.getRange(curStart, curEnd);\n replaceWithStr = replaceWithStr.replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, replaceWith);\n replaceWithStr = replaceWithStr.replace(/[^\\n]/g, replaceWith);\n if (vim.visualBlock) {\n var spaces = new Array(cm.getOption(\"tabSize\") + 1).join(' ');\n replaceWithStr = cm.getSelection();\n replaceWithStr = replaceWithStr.replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, replaceWith);\n replaceWithStr = replaceWithStr.replace(/\\t/g, spaces).replace(/[^\\n]/g, replaceWith).split('\\n');\n cm.replaceSelections(replaceWithStr);\n }\n else {\n cm.replaceRange(replaceWithStr, curStart, curEnd);\n }\n if (vim.visualMode) {\n curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ?\n selections[0].anchor : selections[0].head;\n cm.setCursor(curStart);\n exitVisualMode(cm, false);\n }\n else {\n cm.setCursor(offsetCursor(curEnd, 0, -1));\n }\n }\n },\n incrementNumberToken: function (cm, actionArgs) {\n var cur = cm.getCursor();\n var lineStr = cm.getLine(cur.line);\n var re = /(-?)(?:(0x)([\\da-f]+)|(0b|0|)(\\d+))/gi;\n var match;\n var start;\n var end;\n var numberStr;\n while ((match = re.exec(lineStr)) !== null) {\n start = match.index;\n end = start + match[0].length;\n if (cur.ch < end)\n break;\n }\n if (!actionArgs.backtrack && (end <= cur.ch))\n return;\n if (match) {\n var baseStr = match[2] || match[4];\n var digits = match[3] || match[5];\n var increment = actionArgs.increase ? 1 : -1;\n var base = { '0b': 2, '0': 8, '': 10, '0x': 16 }[baseStr.toLowerCase()];\n var number = parseInt(match[1] + digits, base) + (increment * actionArgs.repeat);\n numberStr = number.toString(base);\n var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : '';\n if (numberStr.charAt(0) === '-') {\n numberStr = '-' + baseStr + zeroPadding + numberStr.substr(1);\n }\n else {\n numberStr = baseStr + zeroPadding + numberStr;\n }\n var from = new Pos(cur.line, start);\n var to = new Pos(cur.line, end);\n cm.replaceRange(numberStr, from, to);\n }\n else {\n return;\n }\n cm.setCursor(new Pos(cur.line, start + numberStr.length - 1));\n },\n repeatLastEdit: function (cm, actionArgs, vim) {\n var lastEditInputState = vim.lastEditInputState;\n if (!lastEditInputState) {\n return;\n }\n var repeat = actionArgs.repeat;\n if (repeat && actionArgs.repeatIsExplicit) {\n vim.lastEditInputState.repeatOverride = repeat;\n }\n else {\n repeat = vim.lastEditInputState.repeatOverride || repeat;\n }\n repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */);\n },\n indent: function (cm, actionArgs) {\n cm.indentLine(cm.getCursor().line, actionArgs.indentRight);\n },\n exitInsertMode: exitInsertMode\n};\nfunction defineAction(name, fn) {\n actions[name] = fn;\n}\nfunction clipCursorToContent(cm, cur, oldCur) {\n var vim = cm.state.vim;\n var includeLineBreak = vim.insertMode || vim.visualMode;\n var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine());\n var text = cm.getLine(line);\n var maxCh = text.length - 1 + !!includeLineBreak;\n var ch = Math.min(Math.max(0, cur.ch), maxCh);\n var charCode = text.charCodeAt(ch);\n if (0xDC00 < charCode && charCode < 0xDFFF) {\n var direction = 1;\n if (oldCur && oldCur.line == line) {\n if (oldCur.ch > ch) {\n direction = -1;\n }\n }\n ch += direction;\n if (ch > maxCh)\n ch -= 2;\n }\n return new Pos(line, ch);\n}\nfunction copyArgs(args) {\n var ret = {};\n for (var prop in args) {\n if (args.hasOwnProperty(prop)) {\n ret[prop] = args[prop];\n }\n }\n return ret;\n}\nfunction offsetCursor(cur, offsetLine, offsetCh) {\n if (typeof offsetLine === 'object') {\n offsetCh = offsetLine.ch;\n offsetLine = offsetLine.line;\n }\n return new Pos(cur.line + offsetLine, cur.ch + offsetCh);\n}\nfunction commandMatches(keys, keyMap, context, inputState) {\n var match, partial = [], full = [];\n for (var i = 0; i < keyMap.length; i++) {\n var command = keyMap[i];\n if (context == 'insert' && command.context != 'insert' ||\n command.context && command.context != context ||\n inputState.operator && command.type == 'action' ||\n !(match = commandMatch(keys, command.keys))) {\n continue;\n }\n if (match == 'partial') {\n partial.push(command);\n }\n if (match == 'full') {\n full.push(command);\n }\n }\n return {\n partial: partial.length && partial,\n full: full.length && full\n };\n}\nfunction commandMatch(pressed, mapped) {\n if (mapped.slice(-11) == '<character>') {\n var prefixLen = mapped.length - 11;\n var pressedPrefix = pressed.slice(0, prefixLen);\n var mappedPrefix = mapped.slice(0, prefixLen);\n return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' :\n mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false;\n }\n else {\n return pressed == mapped ? 'full' :\n mapped.indexOf(pressed) == 0 ? 'partial' : false;\n }\n}\nfunction lastChar(keys) {\n var match = /^.*(<[^>]+>)$/.exec(keys);\n var selectedCharacter = match ? match[1] : keys.slice(-1);\n if (selectedCharacter.length > 1) {\n switch (selectedCharacter) {\n case '<CR>':\n selectedCharacter = '\\n';\n break;\n case '<Space>':\n selectedCharacter = ' ';\n break;\n default:\n selectedCharacter = '';\n break;\n }\n }\n return selectedCharacter;\n}\nfunction repeatFn(cm, fn, repeat) {\n return function () {\n for (var i = 0; i < repeat; i++) {\n fn(cm);\n }\n };\n}\nfunction copyCursor(cur) {\n return new Pos(cur.line, cur.ch);\n}\nfunction cursorEqual(cur1, cur2) {\n return cur1.ch == cur2.ch && cur1.line == cur2.line;\n}\nfunction cursorIsBefore(cur1, cur2) {\n if (cur1.line < cur2.line) {\n return true;\n }\n if (cur1.line == cur2.line && cur1.ch < cur2.ch) {\n return true;\n }\n return false;\n}\nfunction cursorMin(cur1, cur2) {\n if (arguments.length > 2) {\n cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1));\n }\n return cursorIsBefore(cur1, cur2) ? cur1 : cur2;\n}\nfunction cursorMax(cur1, cur2) {\n if (arguments.length > 2) {\n cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1));\n }\n return cursorIsBefore(cur1, cur2) ? cur2 : cur1;\n}\nfunction cursorIsBetween(cur1, cur2, cur3) {\n var cur1before2 = cursorIsBefore(cur1, cur2);\n var cur2before3 = cursorIsBefore(cur2, cur3);\n return cur1before2 && cur2before3;\n}\nfunction lineLength(cm, lineNum) {\n return cm.getLine(lineNum).length;\n}\nfunction trim(s) {\n if (s.trim) {\n return s.trim();\n }\n return s.replace(/^\\s+|\\s+$/g, '');\n}\nfunction escapeRegex(s) {\n return s.replace(/([.?*+$\\[\\]\\/\\\\(){}|\\-])/g, '\\\\$1');\n}\nfunction extendLineToColumn(cm, lineNum, column) {\n var endCh = lineLength(cm, lineNum);\n var spaces = new Array(column - endCh + 1).join(' ');\n cm.setCursor(new Pos(lineNum, endCh));\n cm.replaceRange(spaces, cm.getCursor());\n}\nfunction selectBlock(cm, selectionEnd) {\n var selections = [], ranges = cm.listSelections();\n var head = copyCursor(cm.clipPos(selectionEnd));\n var isClipped = !cursorEqual(selectionEnd, head);\n var curHead = cm.getCursor('head');\n var primIndex = getIndex(ranges, curHead);\n var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor);\n var max = ranges.length - 1;\n var index = max - primIndex > primIndex ? max : 0;\n var base = ranges[index].anchor;\n var firstLine = Math.min(base.line, head.line);\n var lastLine = Math.max(base.line, head.line);\n var baseCh = base.ch, headCh = head.ch;\n var dir = ranges[index].head.ch - baseCh;\n var newDir = headCh - baseCh;\n if (dir > 0 && newDir <= 0) {\n baseCh++;\n if (!isClipped) {\n headCh--;\n }\n }\n else if (dir < 0 && newDir >= 0) {\n baseCh--;\n if (!wasClipped) {\n headCh++;\n }\n }\n else if (dir < 0 && newDir == -1) {\n baseCh--;\n headCh++;\n }\n for (var line = firstLine; line <= lastLine; line++) {\n var range = { anchor: new Pos(line, baseCh), head: new Pos(line, headCh) };\n selections.push(range);\n }\n cm.setSelections(selections);\n selectionEnd.ch = headCh;\n base.ch = baseCh;\n return base;\n}\nfunction selectForInsert(cm, head, height) {\n var sel = [];\n for (var i = 0; i < height; i++) {\n var lineHead = offsetCursor(head, i, 0);\n sel.push({ anchor: lineHead, head: lineHead });\n }\n cm.setSelections(sel, 0);\n}\nfunction getIndex(ranges, cursor, end) {\n for (var i = 0; i < ranges.length; i++) {\n var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor);\n var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor);\n if (atAnchor || atHead) {\n return i;\n }\n }\n return -1;\n}\nfunction getSelectedAreaRange(cm, vim) {\n var lastSelection = vim.lastSelection;\n var getCurrentSelectedAreaRange = function () {\n var selections = cm.listSelections();\n var start = selections[0];\n var end = selections[selections.length - 1];\n var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head;\n var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor;\n return [selectionStart, selectionEnd];\n };\n var getLastSelectedAreaRange = function () {\n var selectionStart = cm.getCursor();\n var selectionEnd = cm.getCursor();\n var block = lastSelection.visualBlock;\n if (block) {\n var width = block.width;\n var height = block.height;\n selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width);\n var selections = [];\n for (var i = selectionStart.line; i < selectionEnd.line; i++) {\n var anchor = new Pos(i, selectionStart.ch);\n var head = new Pos(i, selectionEnd.ch);\n var range = { anchor: anchor, head: head };\n selections.push(range);\n }\n cm.setSelections(selections);\n }\n else {\n var start = lastSelection.anchorMark.find();\n var end = lastSelection.headMark.find();\n var line = end.line - start.line;\n var ch = end.ch - start.ch;\n selectionEnd = { line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch };\n if (lastSelection.visualLine) {\n selectionStart = new Pos(selectionStart.line, 0);\n selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line));\n }\n cm.setSelection(selectionStart, selectionEnd);\n }\n return [selectionStart, selectionEnd];\n };\n if (!vim.visualMode) {\n return getLastSelectedAreaRange();\n }\n else {\n return getCurrentSelectedAreaRange();\n }\n}\nfunction updateLastSelection(cm, vim) {\n var anchor = vim.sel.anchor;\n var head = vim.sel.head;\n if (vim.lastPastedText) {\n head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);\n vim.lastPastedText = null;\n }\n vim.lastSelection = { 'anchorMark': cm.setBookmark(anchor),\n 'headMark': cm.setBookmark(head),\n 'anchor': copyCursor(anchor),\n 'head': copyCursor(head),\n 'visualMode': vim.visualMode,\n 'visualLine': vim.visualLine,\n 'visualBlock': vim.visualBlock };\n}\nfunction expandSelection(cm, start, end) {\n var sel = cm.state.vim.sel;\n var head = sel.head;\n var anchor = sel.anchor;\n var tmp;\n if (cursorIsBefore(end, start)) {\n tmp = end;\n end = start;\n start = tmp;\n }\n if (cursorIsBefore(head, anchor)) {\n head = cursorMin(start, head);\n anchor = cursorMax(anchor, end);\n }\n else {\n anchor = cursorMin(start, anchor);\n head = cursorMax(head, end);\n head = offsetCursor(head, 0, -1);\n if (head.ch == -1 && head.line != cm.firstLine()) {\n head = new Pos(head.line - 1, lineLength(cm, head.line - 1));\n }\n }\n return [anchor, head];\n}\nfunction updateCmSelection(cm, sel, mode) {\n var vim = cm.state.vim;\n sel = sel || vim.sel;\n var mode = mode ||\n vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';\n var cmSel = makeCmSelection(cm, sel, mode);\n cm.setSelections(cmSel.ranges, cmSel.primary);\n}\nfunction makeCmSelection(cm, sel, mode, exclusive) {\n var head = copyCursor(sel.head);\n var anchor = copyCursor(sel.anchor);\n if (mode == 'char') {\n var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;\n var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;\n head = offsetCursor(sel.head, 0, headOffset);\n anchor = offsetCursor(sel.anchor, 0, anchorOffset);\n return {\n ranges: [{ anchor: anchor, head: head }],\n primary: 0\n };\n }\n else if (mode == 'line') {\n if (!cursorIsBefore(sel.head, sel.anchor)) {\n anchor.ch = 0;\n var lastLine = cm.lastLine();\n if (head.line > lastLine) {\n head.line = lastLine;\n }\n head.ch = lineLength(cm, head.line);\n }\n else {\n head.ch = 0;\n anchor.ch = lineLength(cm, anchor.line);\n }\n return {\n ranges: [{ anchor: anchor, head: head }],\n primary: 0\n };\n }\n else if (mode == 'block') {\n var top = Math.min(anchor.line, head.line), fromCh = anchor.ch, bottom = Math.max(anchor.line, head.line), toCh = head.ch;\n if (fromCh < toCh) {\n toCh += 1;\n }\n else {\n fromCh += 1;\n }\n ;\n var height = bottom - top + 1;\n var primary = head.line == top ? 0 : height - 1;\n var ranges = [];\n for (var i = 0; i < height; i++) {\n ranges.push({\n anchor: new Pos(top + i, fromCh),\n head: new Pos(top + i, toCh)\n });\n }\n return {\n ranges: ranges,\n primary: primary\n };\n }\n}\nfunction getHead(cm) {\n var cur = cm.getCursor('head');\n if (cm.getSelection().length == 1) {\n cur = cursorMin(cur, cm.getCursor('anchor'));\n }\n return cur;\n}\nfunction exitVisualMode(cm, moveHead) {\n var vim = cm.state.vim;\n if (moveHead !== false) {\n cm.setCursor(clipCursorToContent(cm, vim.sel.head));\n }\n updateLastSelection(cm, vim);\n vim.visualMode = false;\n vim.visualLine = false;\n vim.visualBlock = false;\n if (!vim.insertMode)\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"normal\" });\n}\nfunction clipToLine(cm, curStart, curEnd) {\n var selection = cm.getRange(curStart, curEnd);\n if (/\\n\\s*$/.test(selection)) {\n var lines = selection.split('\\n');\n lines.pop();\n var line;\n for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) {\n curEnd.line--;\n curEnd.ch = 0;\n }\n if (line) {\n curEnd.line--;\n curEnd.ch = lineLength(cm, curEnd.line);\n }\n else {\n curEnd.ch = 0;\n }\n }\n}\nfunction expandSelectionToLine(_cm, curStart, curEnd) {\n curStart.ch = 0;\n curEnd.ch = 0;\n curEnd.line++;\n}\nfunction findFirstNonWhiteSpaceCharacter(text) {\n if (!text) {\n return 0;\n }\n var firstNonWS = text.search(/\\S/);\n return firstNonWS == -1 ? text.length : firstNonWS;\n}\nfunction expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) {\n var cur = getHead(cm);\n var line = cm.getLine(cur.line);\n var idx = cur.ch;\n var test = noSymbol ? wordCharTest[0] : bigWordCharTest[0];\n while (!test(line.charAt(idx))) {\n idx++;\n if (idx >= line.length) {\n return null;\n }\n }\n if (bigWord) {\n test = bigWordCharTest[0];\n }\n else {\n test = wordCharTest[0];\n if (!test(line.charAt(idx))) {\n test = wordCharTest[1];\n }\n }\n var end = idx, start = idx;\n while (test(line.charAt(end)) && end < line.length) {\n end++;\n }\n while (test(line.charAt(start)) && start >= 0) {\n start--;\n }\n start++;\n if (inclusive) {\n var wordEnd = end;\n while (/\\s/.test(line.charAt(end)) && end < line.length) {\n end++;\n }\n if (wordEnd == end) {\n var wordStart = start;\n while (/\\s/.test(line.charAt(start - 1)) && start > 0) {\n start--;\n }\n if (!start) {\n start = wordStart;\n }\n }\n }\n return { start: new Pos(cur.line, start), end: new Pos(cur.line, end) };\n}\nfunction expandTagUnderCursor(cm, head, inclusive) {\n var cur = head;\n if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) {\n return { start: cur, end: cur };\n }\n var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head);\n if (!tags || !tags.open || !tags.close) {\n return { start: cur, end: cur };\n }\n if (inclusive) {\n return { start: tags.open.from, end: tags.close.to };\n }\n return { start: tags.open.to, end: tags.close.from };\n}\nfunction recordJumpPosition(cm, oldCur, newCur) {\n if (!cursorEqual(oldCur, newCur)) {\n vimGlobalState.jumpList.add(cm, oldCur, newCur);\n }\n}\nfunction recordLastCharacterSearch(increment, args) {\n vimGlobalState.lastCharacterSearch.increment = increment;\n vimGlobalState.lastCharacterSearch.forward = args.forward;\n vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter;\n}\nvar symbolToMode = {\n '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket',\n '[': 'section', ']': 'section',\n '*': 'comment', '/': 'comment',\n 'm': 'method', 'M': 'method',\n '#': 'preprocess'\n};\nvar findSymbolModes = {\n bracket: {\n isComplete: function (state) {\n if (state.nextCh === state.symb) {\n state.depth++;\n if (state.depth >= 1)\n return true;\n }\n else if (state.nextCh === state.reverseSymb) {\n state.depth--;\n }\n return false;\n }\n },\n section: {\n init: function (state) {\n state.curMoveThrough = true;\n state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}';\n },\n isComplete: function (state) {\n return state.index === 0 && state.nextCh === state.symb;\n }\n },\n comment: {\n isComplete: function (state) {\n var found = state.lastCh === '*' && state.nextCh === '/';\n state.lastCh = state.nextCh;\n return found;\n }\n },\n method: {\n init: function (state) {\n state.symb = (state.symb === 'm' ? '{' : '}');\n state.reverseSymb = state.symb === '{' ? '}' : '{';\n },\n isComplete: function (state) {\n if (state.nextCh === state.symb)\n return true;\n return false;\n }\n },\n preprocess: {\n init: function (state) {\n state.index = 0;\n },\n isComplete: function (state) {\n if (state.nextCh === '#') {\n var token = state.lineText.match(/^#(\\w+)/)[1];\n if (token === 'endif') {\n if (state.forward && state.depth === 0) {\n return true;\n }\n state.depth++;\n }\n else if (token === 'if') {\n if (!state.forward && state.depth === 0) {\n return true;\n }\n state.depth--;\n }\n if (token === 'else' && state.depth === 0)\n return true;\n }\n return false;\n }\n }\n};\nfunction findSymbol(cm, repeat, forward, symb) {\n var cur = copyCursor(cm.getCursor());\n var increment = forward ? 1 : -1;\n var endLine = forward ? cm.lineCount() : -1;\n var curCh = cur.ch;\n var line = cur.line;\n var lineText = cm.getLine(line);\n var state = {\n lineText: lineText,\n nextCh: lineText.charAt(curCh),\n lastCh: null,\n index: curCh,\n symb: symb,\n reverseSymb: (forward ? { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb],\n forward: forward,\n depth: 0,\n curMoveThrough: false\n };\n var mode = symbolToMode[symb];\n if (!mode)\n return cur;\n var init = findSymbolModes[mode].init;\n var isComplete = findSymbolModes[mode].isComplete;\n if (init) {\n init(state);\n }\n while (line !== endLine && repeat) {\n state.index += increment;\n state.nextCh = state.lineText.charAt(state.index);\n if (!state.nextCh) {\n line += increment;\n state.lineText = cm.getLine(line) || '';\n if (increment > 0) {\n state.index = 0;\n }\n else {\n var lineLen = state.lineText.length;\n state.index = (lineLen > 0) ? (lineLen - 1) : 0;\n }\n state.nextCh = state.lineText.charAt(state.index);\n }\n if (isComplete(state)) {\n cur.line = line;\n cur.ch = state.index;\n repeat--;\n }\n }\n if (state.nextCh || state.curMoveThrough) {\n return new Pos(line, state.index);\n }\n return cur;\n}\nfunction findWord(cm, cur, forward, bigWord, emptyLineIsWord) {\n var lineNum = cur.line;\n var pos = cur.ch;\n var line = cm.getLine(lineNum);\n var dir = forward ? 1 : -1;\n var charTests = bigWord ? bigWordCharTest : wordCharTest;\n if (emptyLineIsWord && line == '') {\n lineNum += dir;\n line = cm.getLine(lineNum);\n if (!isLine(cm, lineNum)) {\n return null;\n }\n pos = (forward) ? 0 : line.length;\n }\n while (true) {\n if (emptyLineIsWord && line == '') {\n return { from: 0, to: 0, line: lineNum };\n }\n var stop = (dir > 0) ? line.length : -1;\n var wordStart = stop, wordEnd = stop;\n while (pos != stop) {\n var foundWord = false;\n for (var i = 0; i < charTests.length && !foundWord; ++i) {\n if (charTests[i](line.charAt(pos))) {\n wordStart = pos;\n while (pos != stop && charTests[i](line.charAt(pos))) {\n pos += dir;\n }\n wordEnd = pos;\n foundWord = wordStart != wordEnd;\n if (wordStart == cur.ch && lineNum == cur.line &&\n wordEnd == wordStart + dir) {\n continue;\n }\n else {\n return {\n from: Math.min(wordStart, wordEnd + 1),\n to: Math.max(wordStart, wordEnd),\n line: lineNum\n };\n }\n }\n }\n if (!foundWord) {\n pos += dir;\n }\n }\n lineNum += dir;\n if (!isLine(cm, lineNum)) {\n return null;\n }\n line = cm.getLine(lineNum);\n pos = (dir > 0) ? 0 : line.length;\n }\n}\nfunction moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) {\n var curStart = copyCursor(cur);\n var words = [];\n if (forward && !wordEnd || !forward && wordEnd) {\n repeat++;\n }\n var emptyLineIsWord = !(forward && wordEnd);\n for (var i = 0; i < repeat; i++) {\n var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord);\n if (!word) {\n var eodCh = lineLength(cm, cm.lastLine());\n words.push(forward\n ? { line: cm.lastLine(), from: eodCh, to: eodCh }\n : { line: 0, from: 0, to: 0 });\n break;\n }\n words.push(word);\n cur = new Pos(word.line, forward ? (word.to - 1) : word.from);\n }\n var shortCircuit = words.length != repeat;\n var firstWord = words[0];\n var lastWord = words.pop();\n if (forward && !wordEnd) {\n if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) {\n lastWord = words.pop();\n }\n return new Pos(lastWord.line, lastWord.from);\n }\n else if (forward && wordEnd) {\n return new Pos(lastWord.line, lastWord.to - 1);\n }\n else if (!forward && wordEnd) {\n if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) {\n lastWord = words.pop();\n }\n return new Pos(lastWord.line, lastWord.to);\n }\n else {\n return new Pos(lastWord.line, lastWord.from);\n }\n}\nfunction moveToEol(cm, head, motionArgs, vim, keepHPos) {\n var cur = head;\n var retval = new Pos(cur.line + motionArgs.repeat - 1, Infinity);\n var end = cm.clipPos(retval);\n end.ch--;\n if (!keepHPos) {\n vim.lastHPos = Infinity;\n vim.lastHSPos = cm.charCoords(end, 'div').left;\n }\n return retval;\n}\nfunction moveToCharacter(cm, repeat, forward, character) {\n var cur = cm.getCursor();\n var start = cur.ch;\n var idx;\n for (var i = 0; i < repeat; i++) {\n var line = cm.getLine(cur.line);\n idx = charIdxInLine(start, line, character, forward, true);\n if (idx == -1) {\n return null;\n }\n start = idx;\n }\n return new Pos(cm.getCursor().line, idx);\n}\nfunction moveToColumn(cm, repeat) {\n var line = cm.getCursor().line;\n return clipCursorToContent(cm, new Pos(line, repeat - 1));\n}\nfunction updateMark(cm, vim, markName, pos) {\n if (!inArray(markName, validMarks)) {\n return;\n }\n if (vim.marks[markName]) {\n vim.marks[markName].clear();\n }\n vim.marks[markName] = cm.setBookmark(pos);\n}\nfunction charIdxInLine(start, line, character, forward, includeChar) {\n var idx;\n if (forward) {\n idx = line.indexOf(character, start + 1);\n if (idx != -1 && !includeChar) {\n idx -= 1;\n }\n }\n else {\n idx = line.lastIndexOf(character, start - 1);\n if (idx != -1 && !includeChar) {\n idx += 1;\n }\n }\n return idx;\n}\nfunction findParagraph(cm, head, repeat, dir, inclusive) {\n var line = head.line;\n var min = cm.firstLine();\n var max = cm.lastLine();\n var start, end, i = line;\n function isEmpty(i) { return !/\\S/.test(cm.getLine(i)); } // ace_patch\n function isBoundary(i, dir, any) {\n if (any) {\n return isEmpty(i) != isEmpty(i + dir);\n }\n return !isEmpty(i) && isEmpty(i + dir);\n }\n function skipFold(i) {\n dir = dir > 0 ? 1 : -1;\n var foldLine = cm.ace.session.getFoldLine(i);\n if (foldLine) {\n if (i + dir > foldLine.start.row && i + dir < foldLine.end.row)\n dir = (dir > 0 ? foldLine.end.row : foldLine.start.row) - i;\n }\n }\n if (dir) {\n while (min <= i && i <= max && repeat > 0) {\n skipFold(i);\n if (isBoundary(i, dir)) {\n repeat--;\n }\n i += dir;\n }\n return new Pos(i, 0);\n }\n var vim = cm.state.vim;\n if (vim.visualLine && isBoundary(line, 1, true)) {\n var anchor = vim.sel.anchor;\n if (isBoundary(anchor.line, -1, true)) {\n if (!inclusive || anchor.line != line) {\n line += 1;\n }\n }\n }\n var startState = isEmpty(line);\n for (i = line; i <= max && repeat; i++) {\n if (isBoundary(i, 1, true)) {\n if (!inclusive || isEmpty(i) != startState) {\n repeat--;\n }\n }\n }\n end = new Pos(i, 0);\n if (i > max && !startState) {\n startState = true;\n }\n else {\n inclusive = false;\n }\n for (i = line; i > min; i--) {\n if (!inclusive || isEmpty(i) == startState || i == line) {\n if (isBoundary(i, -1, true)) {\n break;\n }\n }\n }\n start = new Pos(i, 0);\n return { start: start, end: end };\n}\nfunction getSentence(cm, cur, repeat, dir, inclusive /*includes whitespace*/) {\n function nextChar(curr) {\n if (curr.pos + curr.dir < 0 || curr.pos + curr.dir >= curr.line.length) {\n curr.line = null;\n }\n else {\n curr.pos += curr.dir;\n }\n }\n function forward(cm, ln, pos, dir) {\n var line = cm.getLine(ln);\n var curr = {\n line: line,\n ln: ln,\n pos: pos,\n dir: dir,\n };\n if (curr.line === \"\") {\n return { ln: curr.ln, pos: curr.pos };\n }\n var lastSentencePos = curr.pos;\n nextChar(curr);\n while (curr.line !== null) {\n lastSentencePos = curr.pos;\n if (isEndOfSentenceSymbol(curr.line[curr.pos])) {\n if (!inclusive) {\n return { ln: curr.ln, pos: curr.pos + 1 };\n }\n else {\n nextChar(curr);\n while (curr.line !== null) {\n if (isWhiteSpaceString(curr.line[curr.pos])) {\n lastSentencePos = curr.pos;\n nextChar(curr);\n }\n else {\n break;\n }\n }\n return { ln: curr.ln, pos: lastSentencePos + 1 };\n }\n }\n nextChar(curr);\n }\n return { ln: curr.ln, pos: lastSentencePos + 1 };\n }\n function reverse(cm, ln, pos, dir) {\n var line = cm.getLine(ln);\n var curr = {\n line: line,\n ln: ln,\n pos: pos,\n dir: dir,\n };\n if (curr.line === \"\") {\n return { ln: curr.ln, pos: curr.pos };\n }\n var lastSentencePos = curr.pos;\n nextChar(curr);\n while (curr.line !== null) {\n if (!isWhiteSpaceString(curr.line[curr.pos]) && !isEndOfSentenceSymbol(curr.line[curr.pos])) {\n lastSentencePos = curr.pos;\n }\n else if (isEndOfSentenceSymbol(curr.line[curr.pos])) {\n if (!inclusive) {\n return { ln: curr.ln, pos: lastSentencePos };\n }\n else {\n if (isWhiteSpaceString(curr.line[curr.pos + 1])) {\n return { ln: curr.ln, pos: curr.pos + 1 };\n }\n else {\n return { ln: curr.ln, pos: lastSentencePos };\n }\n }\n }\n nextChar(curr);\n }\n curr.line = line;\n if (inclusive && isWhiteSpaceString(curr.line[curr.pos])) {\n return { ln: curr.ln, pos: curr.pos };\n }\n else {\n return { ln: curr.ln, pos: lastSentencePos };\n }\n }\n var curr_index = {\n ln: cur.line,\n pos: cur.ch,\n };\n while (repeat > 0) {\n if (dir < 0) {\n curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);\n }\n else {\n curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);\n }\n repeat--;\n }\n return new Pos(curr_index.ln, curr_index.pos);\n}\nfunction findSentence(cm, cur, repeat, dir) {\n function nextChar(cm, idx) {\n if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) {\n idx.ln += idx.dir;\n if (!isLine(cm, idx.ln)) {\n idx.line = null;\n idx.ln = null;\n idx.pos = null;\n return;\n }\n idx.line = cm.getLine(idx.ln);\n idx.pos = (idx.dir > 0) ? 0 : idx.line.length - 1;\n }\n else {\n idx.pos += idx.dir;\n }\n }\n function forward(cm, ln, pos, dir) {\n var line = cm.getLine(ln);\n var stop = (line === \"\");\n var curr = {\n line: line,\n ln: ln,\n pos: pos,\n dir: dir,\n };\n var last_valid = {\n ln: curr.ln,\n pos: curr.pos,\n };\n var skip_empty_lines = (curr.line === \"\");\n nextChar(cm, curr);\n while (curr.line !== null) {\n last_valid.ln = curr.ln;\n last_valid.pos = curr.pos;\n if (curr.line === \"\" && !skip_empty_lines) {\n return { ln: curr.ln, pos: curr.pos, };\n }\n else if (stop && curr.line !== \"\" && !isWhiteSpaceString(curr.line[curr.pos])) {\n return { ln: curr.ln, pos: curr.pos, };\n }\n else if (isEndOfSentenceSymbol(curr.line[curr.pos])\n && !stop\n && (curr.pos === curr.line.length - 1\n || isWhiteSpaceString(curr.line[curr.pos + 1]))) {\n stop = true;\n }\n nextChar(cm, curr);\n }\n var line = cm.getLine(last_valid.ln);\n last_valid.pos = 0;\n for (var i = line.length - 1; i >= 0; --i) {\n if (!isWhiteSpaceString(line[i])) {\n last_valid.pos = i;\n break;\n }\n }\n return last_valid;\n }\n function reverse(cm, ln, pos, dir) {\n var line = cm.getLine(ln);\n var curr = {\n line: line,\n ln: ln,\n pos: pos,\n dir: dir,\n };\n var last_valid = {\n ln: curr.ln,\n pos: null,\n };\n var skip_empty_lines = (curr.line === \"\");\n nextChar(cm, curr);\n while (curr.line !== null) {\n if (curr.line === \"\" && !skip_empty_lines) {\n if (last_valid.pos !== null) {\n return last_valid;\n }\n else {\n return { ln: curr.ln, pos: curr.pos };\n }\n }\n else if (isEndOfSentenceSymbol(curr.line[curr.pos])\n && last_valid.pos !== null\n && !(curr.ln === last_valid.ln && curr.pos + 1 === last_valid.pos)) {\n return last_valid;\n }\n else if (curr.line !== \"\" && !isWhiteSpaceString(curr.line[curr.pos])) {\n skip_empty_lines = false;\n last_valid = { ln: curr.ln, pos: curr.pos };\n }\n nextChar(cm, curr);\n }\n var line = cm.getLine(last_valid.ln);\n last_valid.pos = 0;\n for (var i = 0; i < line.length; ++i) {\n if (!isWhiteSpaceString(line[i])) {\n last_valid.pos = i;\n break;\n }\n }\n return last_valid;\n }\n var curr_index = {\n ln: cur.line,\n pos: cur.ch,\n };\n while (repeat > 0) {\n if (dir < 0) {\n curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);\n }\n else {\n curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);\n }\n repeat--;\n }\n return new Pos(curr_index.ln, curr_index.pos);\n}\nfunction selectCompanionObject(cm, head, symb, inclusive) {\n var cur = head, start, end;\n var bracketRegexp = ({\n '(': /[()]/, ')': /[()]/,\n '[': /[[\\]]/, ']': /[[\\]]/,\n '{': /[{}]/, '}': /[{}]/,\n '<': /[<>]/, '>': /[<>]/\n })[symb];\n var openSym = ({\n '(': '(', ')': '(',\n '[': '[', ']': '[',\n '{': '{', '}': '{',\n '<': '<', '>': '<'\n })[symb];\n var curChar = cm.getLine(cur.line).charAt(cur.ch);\n var offset = curChar === openSym ? 1 : 0;\n start = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), -1, undefined, { 'bracketRegex': bracketRegexp });\n end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, { 'bracketRegex': bracketRegexp });\n if (!start || !end) {\n return { start: cur, end: cur };\n }\n start = start.pos;\n end = end.pos;\n if ((start.line == end.line && start.ch > end.ch)\n || (start.line > end.line)) {\n var tmp = start;\n start = end;\n end = tmp;\n }\n if (inclusive) {\n end.ch += 1;\n }\n else {\n start.ch += 1;\n }\n return { start: start, end: end };\n}\nfunction findBeginningAndEnd(cm, head, symb, inclusive) {\n var cur = copyCursor(head);\n var line = cm.getLine(cur.line);\n var chars = line.split('');\n var start, end, i, len;\n var firstIndex = chars.indexOf(symb);\n if (cur.ch < firstIndex) {\n cur.ch = firstIndex;\n }\n else if (firstIndex < cur.ch && chars[cur.ch] == symb) {\n end = cur.ch; // assign end to the current cursor\n --cur.ch; // make sure to look backwards\n }\n if (chars[cur.ch] == symb && !end) {\n start = cur.ch + 1; // assign start to ahead of the cursor\n }\n else {\n for (i = cur.ch; i > -1 && !start; i--) {\n if (chars[i] == symb) {\n start = i + 1;\n }\n }\n }\n if (start && !end) {\n for (i = start, len = chars.length; i < len && !end; i++) {\n if (chars[i] == symb) {\n end = i;\n }\n }\n }\n if (!start || !end) {\n return { start: cur, end: cur };\n }\n if (inclusive) {\n --start;\n ++end;\n }\n return {\n start: new Pos(cur.line, start),\n end: new Pos(cur.line, end)\n };\n}\ndefineOption('pcre', true, 'boolean');\nfunction SearchState() { }\nSearchState.prototype = {\n getQuery: function () {\n return vimGlobalState.query;\n },\n setQuery: function (query) {\n vimGlobalState.query = query;\n },\n getOverlay: function () {\n return this.searchOverlay;\n },\n setOverlay: function (overlay) {\n this.searchOverlay = overlay;\n },\n isReversed: function () {\n return vimGlobalState.isReversed;\n },\n setReversed: function (reversed) {\n vimGlobalState.isReversed = reversed;\n },\n getScrollbarAnnotate: function () {\n return this.annotate;\n },\n setScrollbarAnnotate: function (annotate) {\n this.annotate = annotate;\n }\n};\nfunction getSearchState(cm) {\n var vim = cm.state.vim;\n return vim.searchState_ || (vim.searchState_ = new SearchState());\n}\nfunction splitBySlash(argString) {\n return splitBySeparator(argString, '/');\n}\nfunction findUnescapedSlashes(argString) {\n return findUnescapedSeparators(argString, '/');\n}\nfunction splitBySeparator(argString, separator) {\n var slashes = findUnescapedSeparators(argString, separator) || [];\n if (!slashes.length)\n return [];\n var tokens = [];\n if (slashes[0] !== 0)\n return;\n for (var i = 0; i < slashes.length; i++) {\n if (typeof slashes[i] == 'number')\n tokens.push(argString.substring(slashes[i] + 1, slashes[i + 1]));\n }\n return tokens;\n}\nfunction findUnescapedSeparators(str, separator) {\n if (!separator)\n separator = '/';\n var escapeNextChar = false;\n var slashes = [];\n for (var i = 0; i < str.length; i++) {\n var c = str.charAt(i);\n if (!escapeNextChar && c == separator) {\n slashes.push(i);\n }\n escapeNextChar = !escapeNextChar && (c == '\\\\');\n }\n return slashes;\n}\nfunction translateRegex(str) {\n var specials = '|(){';\n var unescape = '}';\n var escapeNextChar = false;\n var out = [];\n for (var i = -1; i < str.length; i++) {\n var c = str.charAt(i) || '';\n var n = str.charAt(i + 1) || '';\n var specialComesNext = (n && specials.indexOf(n) != -1);\n if (escapeNextChar) {\n if (c !== '\\\\' || !specialComesNext) {\n out.push(c);\n }\n escapeNextChar = false;\n }\n else {\n if (c === '\\\\') {\n escapeNextChar = true;\n if (n && unescape.indexOf(n) != -1) {\n specialComesNext = true;\n }\n if (!specialComesNext || n === '\\\\') {\n out.push(c);\n }\n }\n else {\n out.push(c);\n if (specialComesNext && n !== '\\\\') {\n out.push('\\\\');\n }\n }\n }\n }\n return out.join('');\n}\nvar charUnescapes = { '\\\\n': '\\n', '\\\\r': '\\r', '\\\\t': '\\t' };\nfunction translateRegexReplace(str) {\n var escapeNextChar = false;\n var out = [];\n for (var i = -1; i < str.length; i++) {\n var c = str.charAt(i) || '';\n var n = str.charAt(i + 1) || '';\n if (charUnescapes[c + n]) {\n out.push(charUnescapes[c + n]);\n i++;\n }\n else if (escapeNextChar) {\n out.push(c);\n escapeNextChar = false;\n }\n else {\n if (c === '\\\\') {\n escapeNextChar = true;\n if ((isNumber(n) || n === '$')) {\n out.push('$');\n }\n else if (n !== '/' && n !== '\\\\') {\n out.push('\\\\');\n }\n }\n else {\n if (c === '$') {\n out.push('$');\n }\n out.push(c);\n if (n === '/') {\n out.push('\\\\');\n }\n }\n }\n }\n return out.join('');\n}\nvar unescapes = { '\\\\/': '/', '\\\\\\\\': '\\\\', '\\\\n': '\\n', '\\\\r': '\\r', '\\\\t': '\\t', '\\\\&': '&' };\nfunction unescapeRegexReplace(str) {\n var stream = new CodeMirror.StringStream(str);\n var output = [];\n while (!stream.eol()) {\n while (stream.peek() && stream.peek() != '\\\\') {\n output.push(stream.next());\n }\n var matched = false;\n for (var matcher in unescapes) {\n if (stream.match(matcher, true)) {\n matched = true;\n output.push(unescapes[matcher]);\n break;\n }\n }\n if (!matched) {\n output.push(stream.next());\n }\n }\n return output.join('');\n}\nfunction parseQuery(query, ignoreCase, smartCase) {\n var lastSearchRegister = vimGlobalState.registerController.getRegister('/');\n lastSearchRegister.setText(query);\n if (query instanceof RegExp) {\n return query;\n }\n var slashes = findUnescapedSlashes(query);\n var regexPart;\n var forceIgnoreCase;\n if (!slashes.length) {\n regexPart = query;\n }\n else {\n regexPart = query.substring(0, slashes[0]);\n var flagsPart = query.substring(slashes[0]);\n forceIgnoreCase = (flagsPart.indexOf('i') != -1);\n }\n if (!regexPart) {\n return null;\n }\n if (!getOption('pcre')) {\n regexPart = translateRegex(regexPart);\n }\n if (smartCase) {\n ignoreCase = (/^[^A-Z]*$/).test(regexPart);\n }\n var regexp = new RegExp(regexPart, (ignoreCase || forceIgnoreCase) ? 'im' : 'm');\n return regexp;\n}\nfunction dom(n) {\n if (typeof n === 'string')\n n = document.createElement(n);\n for (var a, i = 1; i < arguments.length; i++) {\n if (!(a = arguments[i]))\n continue;\n if (typeof a !== 'object')\n a = document.createTextNode(a);\n if (a.nodeType)\n n.appendChild(a);\n else\n for (var key in a) {\n if (!Object.prototype.hasOwnProperty.call(a, key))\n continue;\n if (key[0] === '$')\n n.style[key.slice(1)] = a[key];\n else\n n.setAttribute(key, a[key]);\n }\n }\n return n;\n}\nfunction showConfirm(cm, template) {\n var pre = dom('div', { $color: 'red', $whiteSpace: 'pre', class: 'cm-vim-message' }, template);\n if (cm.openNotification) {\n cm.openNotification(pre, { bottom: true, duration: 5000 });\n }\n else {\n alert(pre.innerText);\n }\n}\nfunction makePrompt(prefix, desc) {\n return dom(document.createDocumentFragment(), dom('span', { $fontFamily: 'monospace', $whiteSpace: 'pre' }, prefix, dom('input', { type: 'text', autocorrect: 'off',\n autocapitalize: 'off', spellcheck: 'false' })), desc && dom('span', { $color: '#888' }, desc));\n}\nfunction showPrompt(cm, options) {\n var template = makePrompt(options.prefix, options.desc);\n if (cm.openDialog) {\n cm.openDialog(template, options.onClose, {\n onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp,\n bottom: true, selectValueOnOpen: false, value: options.value\n });\n }\n else {\n var shortText = '';\n if (typeof options.prefix != \"string\" && options.prefix)\n shortText += options.prefix.textContent;\n if (options.desc)\n shortText += \" \" + options.desc;\n options.onClose(prompt(shortText, ''));\n }\n}\nfunction regexEqual(r1, r2) {\n if (r1 instanceof RegExp && r2 instanceof RegExp) {\n var props = ['global', 'multiline', 'ignoreCase', 'source'];\n for (var i = 0; i < props.length; i++) {\n var prop = props[i];\n if (r1[prop] !== r2[prop]) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\nfunction updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) {\n if (!rawQuery) {\n return;\n }\n var state = getSearchState(cm);\n var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase);\n if (!query) {\n return;\n }\n highlightSearchMatches(cm, query);\n if (regexEqual(query, state.getQuery())) {\n return query;\n }\n state.setQuery(query);\n return query;\n}\nfunction searchOverlay(query) {\n if (query.source.charAt(0) == '^') {\n var matchSol = true;\n }\n return {\n token: function (stream) {\n if (matchSol && !stream.sol()) {\n stream.skipToEnd();\n return;\n }\n var match = stream.match(query, false);\n if (match) {\n if (match[0].length == 0) {\n stream.next();\n return 'searching';\n }\n if (!stream.sol()) {\n stream.backUp(1);\n if (!query.exec(stream.next() + match[0])) {\n stream.next();\n return null;\n }\n }\n stream.match(query);\n return 'searching';\n }\n while (!stream.eol()) {\n stream.next();\n if (stream.match(query, false))\n break;\n }\n },\n query: query\n };\n}\nvar highlightTimeout = 0;\nfunction highlightSearchMatches(cm, query) {\n clearTimeout(highlightTimeout);\n highlightTimeout = setTimeout(function () {\n if (!cm.state.vim)\n return;\n var searchState = getSearchState(cm);\n var overlay = searchState.getOverlay();\n if (!overlay || query != overlay.query) {\n if (overlay) {\n cm.removeOverlay(overlay);\n }\n overlay = searchOverlay(query);\n cm.addOverlay(overlay);\n if (cm.showMatchesOnScrollbar) {\n if (searchState.getScrollbarAnnotate()) {\n searchState.getScrollbarAnnotate().clear();\n }\n searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query));\n }\n searchState.setOverlay(overlay);\n }\n }, 50);\n}\nfunction findNext(cm, prev, query, repeat) {\n if (repeat === undefined) {\n repeat = 1;\n }\n return cm.operation(function () {\n var pos = cm.getCursor();\n var cursor = cm.getSearchCursor(query, pos);\n for (var i = 0; i < repeat; i++) {\n var found = cursor.find(prev);\n if (i == 0 && found && cursorEqual(cursor.from(), pos)) {\n var lastEndPos = prev ? cursor.from() : cursor.to();\n found = cursor.find(prev);\n if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) {\n if (cm.getLine(lastEndPos.line).length == lastEndPos.ch)\n found = cursor.find(prev);\n }\n }\n if (!found) {\n cursor = cm.getSearchCursor(query, (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0));\n if (!cursor.find(prev)) {\n return;\n }\n }\n }\n return cursor.from();\n });\n}\nfunction findNextFromAndToInclusive(cm, prev, query, repeat, vim) {\n if (repeat === undefined) {\n repeat = 1;\n }\n return cm.operation(function () {\n var pos = cm.getCursor();\n var cursor = cm.getSearchCursor(query, pos);\n var found = cursor.find(!prev);\n if (!vim.visualMode && found && cursorEqual(cursor.from(), pos)) {\n cursor.find(!prev);\n }\n for (var i = 0; i < repeat; i++) {\n found = cursor.find(prev);\n if (!found) {\n cursor = cm.getSearchCursor(query, (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0));\n if (!cursor.find(prev)) {\n return;\n }\n }\n }\n return [cursor.from(), cursor.to()];\n });\n}\nfunction clearSearchHighlight(cm) {\n var state = getSearchState(cm);\n cm.removeOverlay(getSearchState(cm).getOverlay());\n state.setOverlay(null);\n if (state.getScrollbarAnnotate()) {\n state.getScrollbarAnnotate().clear();\n state.setScrollbarAnnotate(null);\n }\n}\nfunction isInRange(pos, start, end) {\n if (typeof pos != 'number') {\n pos = pos.line;\n }\n if (start instanceof Array) {\n return inArray(pos, start);\n }\n else {\n if (typeof end == 'number') {\n return (pos >= start && pos <= end);\n }\n else {\n return pos == start;\n }\n }\n}\nfunction getUserVisibleLines(cm) {\n var renderer = cm.ace.renderer;\n return {\n top: renderer.getFirstFullyVisibleRow(),\n bottom: renderer.getLastFullyVisibleRow()\n };\n}\nfunction getMarkPos(cm, vim, markName) {\n if (markName == '\\'' || markName == '`') {\n return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0);\n }\n else if (markName == '.') {\n return getLastEditPos(cm);\n }\n var mark = vim.marks[markName];\n return mark && mark.find();\n}\nfunction getLastEditPos(cm) {\n var undoManager = cm.ace.session.$undoManager;\n if (undoManager && undoManager.$lastDelta)\n return toCmPos(undoManager.$lastDelta.end);\n}\nvar ExCommandDispatcher = function () {\n this.buildCommandMap_();\n};\nExCommandDispatcher.prototype = {\n processCommand: function (cm, input, opt_params) {\n var that = this;\n cm.operation(function () {\n cm.curOp.isVimOp = true;\n that._processCommand(cm, input, opt_params);\n });\n },\n _processCommand: function (cm, input, opt_params) {\n var vim = cm.state.vim;\n var commandHistoryRegister = vimGlobalState.registerController.getRegister(':');\n var previousCommand = commandHistoryRegister.toString();\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n var inputStream = new CodeMirror.StringStream(input);\n commandHistoryRegister.setText(input);\n var params = opt_params || {};\n params.input = input;\n try {\n this.parseInput_(cm, inputStream, params);\n }\n catch (e) {\n showConfirm(cm, e.toString());\n throw e;\n }\n var command;\n var commandName;\n if (!params.commandName) {\n if (params.line !== undefined) {\n commandName = 'move';\n }\n }\n else {\n command = this.matchCommand_(params.commandName);\n if (command) {\n commandName = command.name;\n if (command.excludeFromCommandHistory) {\n commandHistoryRegister.setText(previousCommand);\n }\n this.parseCommandArgs_(inputStream, params, command);\n if (command.type == 'exToKey') {\n for (var i = 0; i < command.toKeys.length; i++) {\n vimApi.handleKey(cm, command.toKeys[i], 'mapping');\n }\n return;\n }\n else if (command.type == 'exToEx') {\n this.processCommand(cm, command.toInput);\n return;\n }\n }\n }\n if (!commandName) {\n showConfirm(cm, 'Not an editor command \":' + input + '\"');\n return;\n }\n try {\n exCommands[commandName](cm, params);\n if ((!command || !command.possiblyAsync) && params.callback) {\n params.callback();\n }\n }\n catch (e) {\n showConfirm(cm, e.toString());\n throw e;\n }\n },\n parseInput_: function (cm, inputStream, result) {\n inputStream.eatWhile(':');\n if (inputStream.eat('%')) {\n result.line = cm.firstLine();\n result.lineEnd = cm.lastLine();\n }\n else {\n result.line = this.parseLineSpec_(cm, inputStream);\n if (result.line !== undefined && inputStream.eat(',')) {\n result.lineEnd = this.parseLineSpec_(cm, inputStream);\n }\n }\n var commandMatch = inputStream.match(/^(\\w+|!!|@@|[!#&*<=>@~])/);\n if (commandMatch) {\n result.commandName = commandMatch[1];\n }\n else {\n result.commandName = inputStream.match(/.*/)[0];\n }\n return result;\n },\n parseLineSpec_: function (cm, inputStream) {\n var numberMatch = inputStream.match(/^(\\d+)/);\n if (numberMatch) {\n return parseInt(numberMatch[1], 10) - 1;\n }\n switch (inputStream.next()) {\n case '.':\n return this.parseLineSpecOffset_(inputStream, cm.getCursor().line);\n case '$':\n return this.parseLineSpecOffset_(inputStream, cm.lastLine());\n case '\\'':\n var markName = inputStream.next();\n var markPos = getMarkPos(cm, cm.state.vim, markName);\n if (!markPos)\n throw new Error('Mark not set');\n return this.parseLineSpecOffset_(inputStream, markPos.line);\n case '-':\n case '+':\n inputStream.backUp(1);\n return this.parseLineSpecOffset_(inputStream, cm.getCursor().line);\n default:\n inputStream.backUp(1);\n return undefined;\n }\n },\n parseLineSpecOffset_: function (inputStream, line) {\n var offsetMatch = inputStream.match(/^([+-])?(\\d+)/);\n if (offsetMatch) {\n var offset = parseInt(offsetMatch[2], 10);\n if (offsetMatch[1] == \"-\") {\n line -= offset;\n }\n else {\n line += offset;\n }\n }\n return line;\n },\n parseCommandArgs_: function (inputStream, params, command) {\n if (inputStream.eol()) {\n return;\n }\n params.argString = inputStream.match(/.*/)[0];\n var delim = command.argDelimiter || /\\s+/;\n var args = trim(params.argString).split(delim);\n if (args.length && args[0]) {\n params.args = args;\n }\n },\n matchCommand_: function (commandName) {\n for (var i = commandName.length; i > 0; i--) {\n var prefix = commandName.substring(0, i);\n if (this.commandMap_[prefix]) {\n var command = this.commandMap_[prefix];\n if (command.name.indexOf(commandName) === 0) {\n return command;\n }\n }\n }\n return null;\n },\n buildCommandMap_: function () {\n this.commandMap_ = {};\n for (var i = 0; i < defaultExCommandMap.length; i++) {\n var command = defaultExCommandMap[i];\n var key = command.shortName || command.name;\n this.commandMap_[key] = command;\n }\n },\n map: function (lhs, rhs, ctx) {\n if (lhs != ':' && lhs.charAt(0) == ':') {\n if (ctx) {\n throw Error('Mode not supported for ex mappings');\n }\n var commandName = lhs.substring(1);\n if (rhs != ':' && rhs.charAt(0) == ':') {\n this.commandMap_[commandName] = {\n name: commandName,\n type: 'exToEx',\n toInput: rhs.substring(1),\n user: true\n };\n }\n else {\n this.commandMap_[commandName] = {\n name: commandName,\n type: 'exToKey',\n toKeys: rhs,\n user: true\n };\n }\n }\n else {\n if (rhs != ':' && rhs.charAt(0) == ':') {\n var mapping = {\n keys: lhs,\n type: 'keyToEx',\n exArgs: { input: rhs.substring(1) }\n };\n if (ctx) {\n mapping.context = ctx;\n }\n defaultKeymap.unshift(mapping);\n }\n else {\n var mapping = {\n keys: lhs,\n type: 'keyToKey',\n toKeys: rhs\n };\n if (ctx) {\n mapping.context = ctx;\n }\n defaultKeymap.unshift(mapping);\n }\n }\n },\n unmap: function (lhs, ctx) {\n if (lhs != ':' && lhs.charAt(0) == ':') {\n if (ctx) {\n throw Error('Mode not supported for ex mappings');\n }\n var commandName = lhs.substring(1);\n if (this.commandMap_[commandName] && this.commandMap_[commandName].user) {\n delete this.commandMap_[commandName];\n return true;\n }\n }\n else {\n var keys = lhs;\n for (var i = 0; i < defaultKeymap.length; i++) {\n if (keys == defaultKeymap[i].keys\n && defaultKeymap[i].context === ctx) {\n defaultKeymap.splice(i, 1);\n return true;\n }\n }\n }\n }\n};\nvar exCommands = {\n colorscheme: function (cm, params) {\n if (!params.args || params.args.length < 1) {\n showConfirm(cm, cm.getOption('theme'));\n return;\n }\n cm.setOption('theme', params.args[0]);\n },\n map: function (cm, params, ctx) {\n var mapArgs = params.args;\n if (!mapArgs || mapArgs.length < 2) {\n if (cm) {\n showConfirm(cm, 'Invalid mapping: ' + params.input);\n }\n return;\n }\n exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx);\n },\n imap: function (cm, params) { this.map(cm, params, 'insert'); },\n nmap: function (cm, params) { this.map(cm, params, 'normal'); },\n vmap: function (cm, params) { this.map(cm, params, 'visual'); },\n unmap: function (cm, params, ctx) {\n var mapArgs = params.args;\n if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) {\n if (cm) {\n showConfirm(cm, 'No such mapping: ' + params.input);\n }\n }\n },\n move: function (cm, params) {\n commandDispatcher.processCommand(cm, cm.state.vim, {\n type: 'motion',\n motion: 'moveToLineOrEdgeOfDocument',\n motionArgs: { forward: false, explicitRepeat: true,\n linewise: true },\n repeatOverride: params.line + 1\n });\n },\n set: function (cm, params) {\n var setArgs = params.args;\n var setCfg = params.setCfg || {};\n if (!setArgs || setArgs.length < 1) {\n if (cm) {\n showConfirm(cm, 'Invalid mapping: ' + params.input);\n }\n return;\n }\n var expr = setArgs[0].split('=');\n var optionName = expr[0];\n var value = expr[1];\n var forceGet = false;\n if (optionName.charAt(optionName.length - 1) == '?') {\n if (value) {\n throw Error('Trailing characters: ' + params.argString);\n }\n optionName = optionName.substring(0, optionName.length - 1);\n forceGet = true;\n }\n if (value === undefined && optionName.substring(0, 2) == 'no') {\n optionName = optionName.substring(2);\n value = false;\n }\n var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean';\n if (optionIsBoolean && value == undefined) {\n value = true;\n }\n if (!optionIsBoolean && value === undefined || forceGet) {\n var oldValue = getOption(optionName, cm, setCfg);\n if (oldValue instanceof Error) {\n showConfirm(cm, oldValue.message);\n }\n else if (oldValue === true || oldValue === false) {\n showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName);\n }\n else {\n showConfirm(cm, ' ' + optionName + '=' + oldValue);\n }\n }\n else {\n var setOptionReturn = setOption(optionName, value, cm, setCfg);\n if (setOptionReturn instanceof Error) {\n showConfirm(cm, setOptionReturn.message);\n }\n }\n },\n setlocal: function (cm, params) {\n params.setCfg = { scope: 'local' };\n this.set(cm, params);\n },\n setglobal: function (cm, params) {\n params.setCfg = { scope: 'global' };\n this.set(cm, params);\n },\n registers: function (cm, params) {\n var regArgs = params.args;\n var registers = vimGlobalState.registerController.registers;\n var regInfo = '----------Registers----------\\n\\n';\n if (!regArgs) {\n for (var registerName in registers) {\n var text = registers[registerName].toString();\n if (text.length) {\n regInfo += '\"' + registerName + ' ' + text + '\\n';\n }\n }\n }\n else {\n var registerName;\n regArgs = regArgs.join('');\n for (var i = 0; i < regArgs.length; i++) {\n registerName = regArgs.charAt(i);\n if (!vimGlobalState.registerController.isValidRegister(registerName)) {\n continue;\n }\n var register = registers[registerName] || new Register();\n regInfo += '\"' + registerName + ' ' + register.toString() + '\\n';\n }\n }\n showConfirm(cm, regInfo);\n },\n sort: function (cm, params) {\n var reverse, ignoreCase, unique, number, pattern;\n function parseArgs() {\n if (params.argString) {\n var args = new CodeMirror.StringStream(params.argString);\n if (args.eat('!')) {\n reverse = true;\n }\n if (args.eol()) {\n return;\n }\n if (!args.eatSpace()) {\n return 'Invalid arguments';\n }\n var opts = args.match(/([dinuox]+)?\\s*(\\/.+\\/)?\\s*/);\n if (!opts && !args.eol()) {\n return 'Invalid arguments';\n }\n if (opts[1]) {\n ignoreCase = opts[1].indexOf('i') != -1;\n unique = opts[1].indexOf('u') != -1;\n var decimal = opts[1].indexOf('d') != -1 || opts[1].indexOf('n') != -1 && 1;\n var hex = opts[1].indexOf('x') != -1 && 1;\n var octal = opts[1].indexOf('o') != -1 && 1;\n if (decimal + hex + octal > 1) {\n return 'Invalid arguments';\n }\n number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';\n }\n if (opts[2]) {\n pattern = new RegExp(opts[2].substr(1, opts[2].length - 2), ignoreCase ? 'i' : '');\n }\n }\n }\n var err = parseArgs();\n if (err) {\n showConfirm(cm, err + ': ' + params.argString);\n return;\n }\n var lineStart = params.line || cm.firstLine();\n var lineEnd = params.lineEnd || params.line || cm.lastLine();\n if (lineStart == lineEnd) {\n return;\n }\n var curStart = new Pos(lineStart, 0);\n var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd));\n var text = cm.getRange(curStart, curEnd).split('\\n');\n var numberRegex = pattern ? pattern :\n (number == 'decimal') ? /(-?)([\\d]+)/ :\n (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i :\n (number == 'octal') ? /([0-7]+)/ : null;\n var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null;\n var numPart = [], textPart = [];\n if (number || pattern) {\n for (var i = 0; i < text.length; i++) {\n var matchPart = pattern ? text[i].match(pattern) : null;\n if (matchPart && matchPart[0] != '') {\n numPart.push(matchPart);\n }\n else if (!pattern && numberRegex.exec(text[i])) {\n numPart.push(text[i]);\n }\n else {\n textPart.push(text[i]);\n }\n }\n }\n else {\n textPart = text;\n }\n function compareFn(a, b) {\n if (reverse) {\n var tmp;\n tmp = a;\n a = b;\n b = tmp;\n }\n if (ignoreCase) {\n a = a.toLowerCase();\n b = b.toLowerCase();\n }\n var anum = number && numberRegex.exec(a);\n var bnum = number && numberRegex.exec(b);\n if (!anum) {\n return a < b ? -1 : 1;\n }\n anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix);\n bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix);\n return anum - bnum;\n }\n function comparePatternFn(a, b) {\n if (reverse) {\n var tmp;\n tmp = a;\n a = b;\n b = tmp;\n }\n if (ignoreCase) {\n a[0] = a[0].toLowerCase();\n b[0] = b[0].toLowerCase();\n }\n return (a[0] < b[0]) ? -1 : 1;\n }\n numPart.sort(pattern ? comparePatternFn : compareFn);\n if (pattern) {\n for (var i = 0; i < numPart.length; i++) {\n numPart[i] = numPart[i].input;\n }\n }\n else if (!number) {\n textPart.sort(compareFn);\n }\n text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart);\n if (unique) { // Remove duplicate lines\n var textOld = text;\n var lastLine;\n text = [];\n for (var i = 0; i < textOld.length; i++) {\n if (textOld[i] != lastLine) {\n text.push(textOld[i]);\n }\n lastLine = textOld[i];\n }\n }\n cm.replaceRange(text.join('\\n'), curStart, curEnd);\n },\n vglobal: function (cm, params) {\n this.global(cm, params);\n },\n global: function (cm, params) {\n var argString = params.argString;\n if (!argString) {\n showConfirm(cm, 'Regular Expression missing from global');\n return;\n }\n var inverted = params.commandName[0] === 'v';\n var lineStart = (params.line !== undefined) ? params.line : cm.firstLine();\n var lineEnd = params.lineEnd || params.line || cm.lastLine();\n var tokens = splitBySlash(argString);\n var regexPart = argString, cmd;\n if (tokens.length) {\n regexPart = tokens[0];\n cmd = tokens.slice(1, tokens.length).join('/');\n }\n if (regexPart) {\n try {\n updateSearchQuery(cm, regexPart, true /** ignoreCase */, true /** smartCase */);\n }\n catch (e) {\n showConfirm(cm, 'Invalid regex: ' + regexPart);\n return;\n }\n }\n var query = getSearchState(cm).getQuery();\n var matchedLines = [];\n for (var i = lineStart; i <= lineEnd; i++) {\n var line = cm.getLineHandle(i);\n var matched = query.test(line.text);\n if (matched !== inverted) {\n matchedLines.push(cmd ? line : line.text);\n }\n }\n if (!cmd) {\n showConfirm(cm, matchedLines.join('\\n'));\n return;\n }\n var index = 0;\n var nextCommand = function () {\n if (index < matchedLines.length) {\n var line = matchedLines[index++];\n var lineNum = cm.getLineNumber(line);\n if (lineNum == null) {\n nextCommand();\n return;\n }\n var command = (lineNum + 1) + cmd;\n exCommandDispatcher.processCommand(cm, command, {\n callback: nextCommand\n });\n }\n };\n nextCommand();\n },\n substitute: function (cm, params) {\n if (!cm.getSearchCursor) {\n throw new Error('Search feature not available. Requires searchcursor.js or ' +\n 'any other getSearchCursor implementation.');\n }\n var argString = params.argString;\n var tokens = argString ? splitBySeparator(argString, argString[0]) : [];\n var regexPart, replacePart = '', trailing, flagsPart, count;\n var confirm = false; // Whether to confirm each replace.\n var global = false; // True to replace all instances on a line, false to replace only 1.\n if (tokens.length) {\n regexPart = tokens[0];\n if (getOption('pcre') && regexPart !== '') {\n regexPart = new RegExp(regexPart).source; //normalize not escaped characters\n }\n replacePart = tokens[1];\n if (replacePart !== undefined) {\n if (getOption('pcre')) {\n replacePart = unescapeRegexReplace(replacePart.replace(/([^\\\\])&/g, \"$1$$&\"));\n }\n else {\n replacePart = translateRegexReplace(replacePart);\n }\n vimGlobalState.lastSubstituteReplacePart = replacePart;\n }\n trailing = tokens[2] ? tokens[2].split(' ') : [];\n }\n else {\n if (argString && argString.length) {\n showConfirm(cm, 'Substitutions should be of the form ' +\n ':s/pattern/replace/');\n return;\n }\n }\n if (trailing) {\n flagsPart = trailing[0];\n count = parseInt(trailing[1]);\n if (flagsPart) {\n if (flagsPart.indexOf('c') != -1) {\n confirm = true;\n }\n if (flagsPart.indexOf('g') != -1) {\n global = true;\n }\n if (getOption('pcre')) {\n regexPart = regexPart + '/' + flagsPart;\n }\n else {\n regexPart = regexPart.replace(/\\//g, \"\\\\/\") + '/' + flagsPart;\n }\n }\n }\n if (regexPart) {\n try {\n updateSearchQuery(cm, regexPart, true /** ignoreCase */, true /** smartCase */);\n }\n catch (e) {\n showConfirm(cm, 'Invalid regex: ' + regexPart);\n return;\n }\n }\n replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart;\n if (replacePart === undefined) {\n showConfirm(cm, 'No previous substitute regular expression');\n return;\n }\n var state = getSearchState(cm);\n var query = state.getQuery();\n var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line;\n var lineEnd = params.lineEnd || lineStart;\n if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) {\n lineEnd = Infinity;\n }\n if (count) {\n lineStart = lineEnd;\n lineEnd = lineStart + count - 1;\n }\n var startPos = clipCursorToContent(cm, new Pos(lineStart, 0));\n var cursor = cm.getSearchCursor(query, startPos);\n doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback);\n },\n redo: CodeMirror.commands.redo,\n undo: CodeMirror.commands.undo,\n write: function (cm) {\n if (CodeMirror.commands.save) {\n CodeMirror.commands.save(cm);\n }\n else if (cm.save) {\n cm.save();\n }\n },\n nohlsearch: function (cm) {\n clearSearchHighlight(cm);\n },\n yank: function (cm) {\n var cur = copyCursor(cm.getCursor());\n var line = cur.line;\n var lineText = cm.getLine(line);\n vimGlobalState.registerController.pushText('0', 'yank', lineText, true, true);\n },\n delmarks: function (cm, params) {\n if (!params.argString || !trim(params.argString)) {\n showConfirm(cm, 'Argument required');\n return;\n }\n var state = cm.state.vim;\n var stream = new CodeMirror.StringStream(trim(params.argString));\n while (!stream.eol()) {\n stream.eatSpace();\n var count = stream.pos;\n if (!stream.match(/[a-zA-Z]/, false)) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n var sym = stream.next();\n if (stream.match('-', true)) {\n if (!stream.match(/[a-zA-Z]/, false)) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n var startMark = sym;\n var finishMark = stream.next();\n if (isLowerCase(startMark) && isLowerCase(finishMark) ||\n isUpperCase(startMark) && isUpperCase(finishMark)) {\n var start = startMark.charCodeAt(0);\n var finish = finishMark.charCodeAt(0);\n if (start >= finish) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n for (var j = 0; j <= finish - start; j++) {\n var mark = String.fromCharCode(start + j);\n delete state.marks[mark];\n }\n }\n else {\n showConfirm(cm, 'Invalid argument: ' + startMark + '-');\n return;\n }\n }\n else {\n delete state.marks[sym];\n }\n }\n }\n};\nvar exCommandDispatcher = new ExCommandDispatcher();\nfunction doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query, replaceWith, callback) {\n cm.state.vim.exMode = true;\n var done = false;\n var lastPos, modifiedLineNumber, joined;\n function replaceAll() {\n cm.operation(function () {\n while (!done) {\n replace();\n next();\n }\n stop();\n });\n }\n function replace() {\n var text = cm.getRange(searchCursor.from(), searchCursor.to());\n var newText = text.replace(query, replaceWith);\n var unmodifiedLineNumber = searchCursor.to().line;\n searchCursor.replace(newText);\n modifiedLineNumber = searchCursor.to().line;\n lineEnd += modifiedLineNumber - unmodifiedLineNumber;\n joined = modifiedLineNumber < unmodifiedLineNumber;\n }\n function findNextValidMatch() {\n var lastMatchTo = lastPos && copyCursor(searchCursor.to());\n var match = searchCursor.findNext();\n if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) {\n match = searchCursor.findNext();\n }\n return match;\n }\n function next() {\n while (findNextValidMatch() &&\n isInRange(searchCursor.from(), lineStart, lineEnd)) {\n if (!global && searchCursor.from().line == modifiedLineNumber && !joined) {\n continue;\n }\n cm.scrollIntoView(searchCursor.from(), 30);\n cm.setSelection(searchCursor.from(), searchCursor.to());\n lastPos = searchCursor.from();\n done = false;\n return;\n }\n done = true;\n }\n function stop(close) {\n if (close) {\n close();\n }\n cm.focus();\n if (lastPos) {\n cm.setCursor(lastPos);\n var vim = cm.state.vim;\n vim.exMode = false;\n vim.lastHPos = vim.lastHSPos = lastPos.ch;\n }\n if (callback) {\n callback();\n }\n }\n function onPromptKeyDown(e, _value, close) {\n CodeMirror.e_stop(e);\n var keyName = CodeMirror.keyName(e);\n switch (keyName) {\n case 'Y':\n replace();\n next();\n break;\n case 'N':\n next();\n break;\n case 'A':\n var savedCallback = callback;\n callback = undefined;\n cm.operation(replaceAll);\n callback = savedCallback;\n break;\n case 'L':\n replace();\n case 'Q':\n case 'Esc':\n case 'Ctrl-C':\n case 'Ctrl-[':\n stop(close);\n break;\n }\n if (done) {\n stop(close);\n }\n return true;\n }\n next();\n if (done) {\n showConfirm(cm, 'No matches for ' + query.source);\n return;\n }\n if (!confirm) {\n replaceAll();\n if (callback) {\n callback();\n }\n return;\n }\n showPrompt(cm, {\n prefix: dom('span', 'replace with ', dom('strong', replaceWith), ' (y/n/a/q/l)'),\n onKeyDown: onPromptKeyDown\n });\n}\nCodeMirror.keyMap.vim = {\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n};\nfunction exitInsertMode(cm) {\n var vim = cm.state.vim;\n var macroModeState = vimGlobalState.macroModeState;\n var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');\n var isPlaying = macroModeState.isPlaying;\n var lastChange = macroModeState.lastInsertModeChanges;\n if (!isPlaying) {\n cm.off('change', onChange);\n CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);\n }\n if (!isPlaying && vim.insertModeRepeat > 1) {\n repeatLastEdit(cm, vim, vim.insertModeRepeat - 1, true /** repeatForInsert */);\n vim.lastEditInputState.repeatOverride = vim.insertModeRepeat;\n }\n delete vim.insertModeRepeat;\n vim.insertMode = false;\n cm.setCursor(cm.getCursor().line, cm.getCursor().ch - 1);\n cm.setOption('keyMap', 'vim');\n cm.setOption('disableInput', true);\n cm.toggleOverwrite(false); // exit replace mode if we were in it.\n insertModeChangeRegister.setText(lastChange.changes.join(''));\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"normal\" });\n if (macroModeState.isRecording) {\n logInsertModeChange(macroModeState);\n }\n}\nfunction _mapCommand(command) {\n defaultKeymap.unshift(command);\n}\nfunction mapCommand(keys, type, name, args, extra) {\n var command = { keys: keys, type: type };\n command[type] = name;\n command[type + \"Args\"] = args;\n for (var key in extra)\n command[key] = extra[key];\n _mapCommand(command);\n}\ndefineOption('insertModeEscKeysTimeout', 200, 'number');\nCodeMirror.keyMap['vim-insert'] = {\n fallthrough: ['default'],\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n};\nCodeMirror.keyMap['vim-replace'] = {\n 'Backspace': 'goCharLeft',\n fallthrough: ['vim-insert'],\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n};\nfunction executeMacroRegister(cm, vim, macroModeState, registerName) {\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (registerName == ':') {\n if (register.keyBuffer[0]) {\n exCommandDispatcher.processCommand(cm, register.keyBuffer[0]);\n }\n macroModeState.isPlaying = false;\n return;\n }\n var keyBuffer = register.keyBuffer;\n var imc = 0;\n macroModeState.isPlaying = true;\n macroModeState.replaySearchQueries = register.searchQueries.slice(0);\n for (var i = 0; i < keyBuffer.length; i++) {\n var text = keyBuffer[i];\n var match, key;\n while (text) {\n match = (/<\\w+-.+?>|<\\w+>|./).exec(text);\n key = match[0];\n text = text.substring(match.index + key.length);\n vimApi.handleKey(cm, key, 'macro');\n if (vim.insertMode) {\n var changes = register.insertModeChanges[imc++].changes;\n vimGlobalState.macroModeState.lastInsertModeChanges.changes =\n changes;\n repeatInsertModeChanges(cm, changes, 1);\n exitInsertMode(cm);\n }\n }\n }\n macroModeState.isPlaying = false;\n}\nfunction logKey(macroModeState, key) {\n if (macroModeState.isPlaying) {\n return;\n }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register) {\n register.pushText(key);\n }\n}\nfunction logInsertModeChange(macroModeState) {\n if (macroModeState.isPlaying) {\n return;\n }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register && register.pushInsertModeChanges) {\n register.pushInsertModeChanges(macroModeState.lastInsertModeChanges);\n }\n}\nfunction logSearchQuery(macroModeState, query) {\n if (macroModeState.isPlaying) {\n return;\n }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register && register.pushSearchQuery) {\n register.pushSearchQuery(query);\n }\n}\nfunction onChange(cm, changeObj) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n if (!macroModeState.isPlaying) {\n while (changeObj) {\n lastChange.expectCursorActivityForChange = true;\n if (lastChange.ignoreCount > 1) {\n lastChange.ignoreCount--;\n }\n else if (changeObj.origin == '+input' || changeObj.origin == 'paste'\n || changeObj.origin === undefined /* only in testing */) {\n var selectionCount = cm.listSelections().length;\n if (selectionCount > 1)\n lastChange.ignoreCount = selectionCount;\n var text = changeObj.text.join('\\n');\n if (lastChange.maybeReset) {\n lastChange.changes = [];\n lastChange.maybeReset = false;\n }\n if (text) {\n if (cm.state.overwrite && !/\\n/.test(text)) {\n lastChange.changes.push([text]);\n }\n else {\n lastChange.changes.push(text);\n }\n }\n }\n changeObj = changeObj.next;\n }\n }\n}\nfunction onCursorActivity(cm) {\n var vim = cm.state.vim;\n if (vim.insertMode) {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) {\n return;\n }\n var lastChange = macroModeState.lastInsertModeChanges;\n if (lastChange.expectCursorActivityForChange) {\n lastChange.expectCursorActivityForChange = false;\n }\n else {\n lastChange.maybeReset = true;\n }\n }\n else if (!cm.curOp.isVimOp) {\n handleExternalSelection(cm, vim);\n }\n}\nfunction handleExternalSelection(cm, vim, keepHPos) {\n var anchor = cm.getCursor('anchor');\n var head = cm.getCursor('head');\n if (vim.visualMode && !cm.somethingSelected()) {\n exitVisualMode(cm, false);\n }\n else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) {\n vim.visualMode = true;\n vim.visualLine = false;\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\" });\n }\n if (vim.visualMode) {\n var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;\n var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;\n head = offsetCursor(head, 0, headOffset);\n anchor = offsetCursor(anchor, 0, anchorOffset);\n vim.sel = {\n anchor: anchor,\n head: head\n };\n updateMark(cm, vim, '<', cursorMin(head, anchor));\n updateMark(cm, vim, '>', cursorMax(head, anchor));\n }\n else if (!vim.insertMode && !keepHPos) {\n vim.lastHPos = cm.getCursor().ch;\n }\n}\nfunction InsertModeKey(keyName) {\n this.keyName = keyName;\n}\nfunction onKeyEventTargetKeyDown(e) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n var keyName = CodeMirror.keyName(e);\n if (!keyName) {\n return;\n }\n function onKeyFound() {\n if (lastChange.maybeReset) {\n lastChange.changes = [];\n lastChange.maybeReset = false;\n }\n lastChange.changes.push(new InsertModeKey(keyName));\n return true;\n }\n if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) {\n CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound);\n }\n}\nfunction repeatLastEdit(cm, vim, repeat, repeatForInsert) {\n var macroModeState = vimGlobalState.macroModeState;\n macroModeState.isPlaying = true;\n var isAction = !!vim.lastEditActionCommand;\n var cachedInputState = vim.inputState;\n function repeatCommand() {\n if (isAction) {\n commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand);\n }\n else {\n commandDispatcher.evalInput(cm, vim);\n }\n }\n function repeatInsert(repeat) {\n if (macroModeState.lastInsertModeChanges.changes.length > 0) {\n repeat = !vim.lastEditActionCommand ? 1 : repeat;\n var changeObject = macroModeState.lastInsertModeChanges;\n repeatInsertModeChanges(cm, changeObject.changes, repeat);\n }\n }\n vim.inputState = vim.lastEditInputState;\n if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) {\n for (var i = 0; i < repeat; i++) {\n repeatCommand();\n repeatInsert(1);\n }\n }\n else {\n if (!repeatForInsert) {\n repeatCommand();\n }\n repeatInsert(repeat);\n }\n vim.inputState = cachedInputState;\n if (vim.insertMode && !repeatForInsert) {\n exitInsertMode(cm);\n }\n macroModeState.isPlaying = false;\n}\nfunction repeatInsertModeChanges(cm, changes, repeat) {\n function keyHandler(binding) {\n if (typeof binding == 'string') {\n CodeMirror.commands[binding](cm);\n }\n else {\n binding(cm);\n }\n return true;\n }\n var head = cm.getCursor('head');\n var visualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.visualBlock;\n if (visualBlock) {\n selectForInsert(cm, head, visualBlock + 1);\n repeat = cm.listSelections().length;\n cm.setCursor(head);\n }\n for (var i = 0; i < repeat; i++) {\n if (visualBlock) {\n cm.setCursor(offsetCursor(head, i, 0));\n }\n for (var j = 0; j < changes.length; j++) {\n var change = changes[j];\n if (change instanceof InsertModeKey) {\n CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);\n }\n else if (typeof change == \"string\") {\n cm.replaceSelection(change);\n }\n else {\n var start = cm.getCursor();\n var end = offsetCursor(start, 0, change[0].length);\n cm.replaceRange(change[0], start, end);\n cm.setCursor(end);\n }\n }\n }\n if (visualBlock) {\n cm.setCursor(offsetCursor(head, 0, 1));\n }\n}\nresetVimGlobalState();\nCodeMirror.Vim = vimApi;\nvar specialKey = { 'return': 'CR', backspace: 'BS', 'delete': 'Del', esc: 'Esc',\n left: 'Left', right: 'Right', up: 'Up', down: 'Down', space: 'Space', insert: 'Ins',\n home: 'Home', end: 'End', pageup: 'PageUp', pagedown: 'PageDown', enter: 'CR'\n};\nfunction lookupKey(hashId, key, e) {\n if (key.length > 1 && key[0] == \"n\") {\n key = key.replace(\"numpad\", \"\");\n }\n key = specialKey[key] || key;\n var name = '';\n if (e.ctrlKey) {\n name += 'C-';\n }\n if (e.altKey) {\n name += 'A-';\n }\n if ((name || key.length > 1) && e.shiftKey) {\n name += 'S-';\n }\n name += key;\n if (name.length > 1) {\n name = '<' + name + '>';\n }\n return name;\n}\nvar handleKey = vimApi.handleKey.bind(vimApi);\nvimApi.handleKey = function (cm, key, origin) {\n return cm.operation(function () {\n return handleKey(cm, key, origin);\n }, true);\n};\nfunction cloneVimState(state) {\n var n = new state.constructor();\n Object.keys(state).forEach(function (key) {\n var o = state[key];\n if (Array.isArray(o))\n o = o.slice();\n else if (o && typeof o == \"object\" && o.constructor != Object)\n o = cloneVimState(o);\n n[key] = o;\n });\n if (state.sel) {\n n.sel = {\n head: state.sel.head && copyCursor(state.sel.head),\n anchor: state.sel.anchor && copyCursor(state.sel.anchor)\n };\n }\n return n;\n}\nfunction multiSelectHandleKey(cm, key, origin) {\n var isHandled = false;\n var vim = vimApi.maybeInitVimState_(cm);\n var visualBlock = vim.visualBlock || vim.wasInVisualBlock;\n var wasMultiselect = cm.ace.inMultiSelectMode;\n if (vim.wasInVisualBlock && !wasMultiselect) {\n vim.wasInVisualBlock = false;\n }\n else if (wasMultiselect && vim.visualBlock) {\n vim.wasInVisualBlock = true;\n }\n if (key == '<Esc>' && !vim.insertMode && !vim.visualMode && wasMultiselect) {\n cm.ace.exitMultiSelectMode();\n }\n else if (visualBlock || !wasMultiselect || cm.ace.inVirtualSelectionMode) {\n isHandled = vimApi.handleKey(cm, key, origin);\n }\n else {\n var old = cloneVimState(vim);\n cm.operation(function () {\n cm.ace.forEachSelection(function () {\n var sel = cm.ace.selection;\n cm.state.vim.lastHPos = sel.$desiredColumn == null ? sel.lead.column : sel.$desiredColumn;\n var head = cm.getCursor(\"head\");\n var anchor = cm.getCursor(\"anchor\");\n var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;\n var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;\n head = offsetCursor(head, 0, headOffset);\n anchor = offsetCursor(anchor, 0, anchorOffset);\n cm.state.vim.sel.head = head;\n cm.state.vim.sel.anchor = anchor;\n isHandled = handleKey(cm, key, origin);\n sel.$desiredColumn = cm.state.vim.lastHPos == -1 ? null : cm.state.vim.lastHPos;\n if (cm.virtualSelectionMode()) {\n cm.state.vim = cloneVimState(old);\n }\n });\n if (cm.curOp.cursorActivity && !isHandled)\n cm.curOp.cursorActivity = false;\n }, true);\n }\n if (isHandled && !vim.visualMode && !vim.insert && vim.visualMode != cm.somethingSelected()) {\n handleExternalSelection(cm, vim, true);\n }\n return isHandled;\n}\nexports.CodeMirror = CodeMirror;\nvar getVim = vimApi.maybeInitVimState_;\nexports.handler = {\n $id: \"ace/keyboard/vim\",\n drawCursor: function (element, pixelPos, config, sel, session) {\n var vim = this.state.vim || {};\n var w = config.characterWidth;\n var h = config.lineHeight;\n var top = pixelPos.top;\n var left = pixelPos.left;\n if (!vim.insertMode) {\n var isbackwards = !sel.cursor\n ? session.selection.isBackwards() || session.selection.isEmpty()\n : Range.comparePoints(sel.cursor, sel.start) <= 0;\n if (!isbackwards && left > w)\n left -= w;\n }\n if (!vim.insertMode && vim.status) {\n h = h / 2;\n top += h;\n }\n domLib.translate(element, left, top);\n domLib.setStyle(element.style, \"width\", w + \"px\");\n domLib.setStyle(element.style, \"height\", h + \"px\");\n },\n $getDirectionForHighlight: function (editor) {\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (!vim.insertMode) {\n return editor.session.selection.isBackwards() || editor.session.selection.isEmpty();\n }\n },\n handleKeyboard: function (data, hashId, key, keyCode, e) {\n var editor = data.editor;\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (keyCode == -1)\n return;\n if (!vim.insertMode) {\n if (hashId == -1) {\n if (key.charCodeAt(0) > 0xFF) {\n if (data.inputKey) {\n key = data.inputKey;\n if (key && data.inputHash == 4)\n key = key.toUpperCase();\n }\n }\n data.inputChar = key;\n }\n else if (hashId == 4 || hashId == 0) {\n if (data.inputKey == key && data.inputHash == hashId && data.inputChar) {\n key = data.inputChar;\n hashId = -1;\n }\n else {\n data.inputChar = null;\n data.inputKey = key;\n data.inputHash = hashId;\n }\n }\n else {\n data.inputChar = data.inputKey = null;\n }\n }\n if (cm.state.overwrite && vim.insertMode && key == \"backspace\" && hashId == 0) {\n return { command: \"gotoleft\" };\n }\n if (key == \"c\" && hashId == 1) { // key == \"ctrl-c\"\n if (!useragent.isMac && editor.getCopyText()) {\n editor.once(\"copy\", function () {\n if (vim.insertMode)\n editor.selection.clearSelection();\n else\n cm.operation(function () { exitVisualMode(cm); });\n });\n return { command: \"null\", passEvent: true };\n }\n }\n if (key == \"esc\" && !vim.insertMode && !vim.visualMode && !cm.ace.inMultiSelectMode) {\n var searchState = getSearchState(cm);\n var overlay = searchState.getOverlay();\n if (overlay)\n cm.removeOverlay(overlay);\n }\n if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) {\n var insertMode = vim.insertMode;\n var name = lookupKey(hashId, key, e || {});\n if (vim.status == null)\n vim.status = \"\";\n var isHandled = multiSelectHandleKey(cm, name, 'user');\n vim = getVim(cm); // may be changed by multiSelectHandleKey\n if (isHandled && vim.status != null)\n vim.status += name;\n else if (vim.status == null)\n vim.status = \"\";\n cm._signal(\"changeStatus\");\n if (!isHandled && (hashId != -1 || insertMode))\n return;\n return { command: \"null\", passEvent: !isHandled };\n }\n },\n attach: function (editor) {\n if (!editor.state)\n editor.state = {};\n var cm = new CodeMirror(editor);\n editor.state.cm = cm;\n editor.$vimModeHandler = this;\n CodeMirror.keyMap.vim.attach(cm);\n getVim(cm).status = null;\n cm.on('vim-command-done', function () {\n if (cm.virtualSelectionMode())\n return;\n getVim(cm).status = null;\n cm.ace._signal(\"changeStatus\");\n cm.ace.session.markUndoGroup();\n });\n cm.on(\"changeStatus\", function () {\n cm.ace.renderer.updateCursor();\n cm.ace._signal(\"changeStatus\");\n });\n cm.on(\"vim-mode-change\", function () {\n if (cm.virtualSelectionMode())\n return;\n updateInputMode();\n cm._signal(\"changeStatus\");\n });\n function updateInputMode() {\n var isIntsert = getVim(cm).insertMode;\n cm.ace.renderer.setStyle(\"normal-mode\", !isIntsert);\n editor.textInput.setCommandMode(!isIntsert);\n editor.renderer.$keepTextAreaAtCursor = isIntsert;\n editor.renderer.$blockCursor = !isIntsert;\n }\n updateInputMode();\n editor.renderer.$cursorLayer.drawCursor = this.drawCursor.bind(cm);\n },\n detach: function (editor) {\n var cm = editor.state.cm;\n CodeMirror.keyMap.vim.detach(cm);\n cm.destroy();\n editor.state.cm = null;\n editor.$vimModeHandler = null;\n editor.renderer.$cursorLayer.drawCursor = null;\n editor.renderer.setStyle(\"normal-mode\", false);\n editor.textInput.setCommandMode(false);\n editor.renderer.$keepTextAreaAtCursor = true;\n },\n getStatusText: function (editor) {\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (vim.insertMode)\n return \"INSERT\";\n var status = \"\";\n if (vim.visualMode) {\n status += \"VISUAL\";\n if (vim.visualLine)\n status += \" LINE\";\n if (vim.visualBlock)\n status += \" BLOCK\";\n }\n if (vim.status)\n status += (status ? \" \" : \"\") + vim.status;\n return status;\n }\n};\nvimApi.defineOption({\n name: \"wrap\",\n set: function (value, cm) {\n if (cm) {\n cm.ace.setOption(\"wrap\", value);\n }\n },\n type: \"boolean\"\n}, false);\nvimApi.defineEx('write', 'w', function () {\n console.log(':write is not implemented');\n});\ndefaultKeymap.push({ keys: 'zc', type: 'action', action: 'fold', actionArgs: { open: false } }, { keys: 'zC', type: 'action', action: 'fold', actionArgs: { open: false, all: true } }, { keys: 'zo', type: 'action', action: 'fold', actionArgs: { open: true } }, { keys: 'zO', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: 'za', type: 'action', action: 'fold', actionArgs: { toggle: true } }, { keys: 'zA', type: 'action', action: 'fold', actionArgs: { toggle: true, all: true } }, { keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: '<C-A-k>', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorAbove\" } }, { keys: '<C-A-j>', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorBelow\" } }, { keys: '<C-A-S-k>', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorAboveSkipCurrent\" } }, { keys: '<C-A-S-j>', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorBelowSkipCurrent\" } }, { keys: '<C-A-h>', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectMoreBefore\" } }, { keys: '<C-A-l>', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectMoreAfter\" } }, { keys: '<C-A-S-h>', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectNextBefore\" } }, { keys: '<C-A-S-l>', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectNextAfter\" } });\ndefaultKeymap.push({\n keys: 'gq',\n type: 'operator',\n operator: 'hardWrap'\n});\nvimApi.defineOperator(\"hardWrap\", function (cm, operatorArgs, ranges, oldAnchor, newHead) {\n var anchor = ranges[0].anchor.line;\n var head = ranges[0].head.line;\n if (operatorArgs.linewise)\n head--;\n hardWrap(cm.ace, { startRow: anchor, endRow: head });\n return Pos(head, 0);\n});\ndefineOption('textwidth', undefined, 'number', ['tw'], function (width, cm) {\n if (cm === undefined) {\n return;\n }\n if (width === undefined) {\n var value = cm.ace.getOption('printMarginColumn');\n return value;\n }\n else {\n var column = Math.round(width);\n if (column > 1) {\n cm.ace.setOption('printMarginColumn', column);\n }\n }\n});\nactions.aceCommand = function (cm, actionArgs, vim) {\n cm.vimCmd = actionArgs;\n if (cm.ace.inVirtualSelectionMode)\n cm.ace.on(\"beforeEndOperation\", delayedExecAceCommand);\n else\n delayedExecAceCommand(null, cm.ace);\n};\nfunction delayedExecAceCommand(op, ace) {\n ace.off(\"beforeEndOperation\", delayedExecAceCommand);\n var cmd = ace.state.cm.vimCmd;\n if (cmd) {\n ace.execCommand(cmd.exec ? cmd : cmd.name, cmd.args);\n }\n ace.curOp = ace.prevOp;\n}\nactions.fold = function (cm, actionArgs, vim) {\n cm.ace.execCommand(['toggleFoldWidget', 'toggleFoldWidget', 'foldOther', 'unfoldall'\n ][(actionArgs.all ? 2 : 0) + (actionArgs.open ? 1 : 0)]);\n};\nexports.handler.defaultKeymap = defaultKeymap;\nexports.handler.actions = actions;\nexports.Vim = vimApi;\n\n}); (function() {\n ace.require([\"ace/keyboard/vim\"], function(m) {\n if (typeof module == \"object\" && typeof exports == \"object\" && module) {\n module.exports = m;\n }\n });\n })();\n "],"names":["require","exports","module","Range","hardWrap","editor","options","max","allowMerge","row","endRow","session","line","space","findSpace","indentation","nextLine","trimmedLine","trimmedNextLine","mergedLine","replaceRange","min","before","after","spaceAfter","spaceBefore","start","end","wrapAfterInput","e","cursor","lastDelta","Editor","val","EventEmitter","domLib","oop","KEYS","event","Search","useragent","SearchHighlight","multiSelectCommands","TextModeTokenRe","CodeMirror","ace","ch","Pos","name","setter","cm","key","m","cmd","lookupKey","map","handle","found","i","result","head","o","delta","change","curOp","fn","force","prevOp","op","eventName","handlers","listeners","shouldScroll","p","sel","pos","toCmPos","ranges","r","primIndex","x","anchor","toAcePos","range","a","h","isInsert","rowShift","colShift","point","cmp","cmp2","Marker","id","column","bm","increment","unit","amount","goalColumn","renderer","config","screenPos","mode","sc","lh","cw","top","col","query","caseFold","caseSensitive","isRegexp","search","acePos","last","back","text","y","maxHeight","margin","viewMargin","s","optMap","aceOpt","on","highlight","marker","re","v","token","method","index","dir","_","tokenRe","cmPos","StringStream","string","tabSize","match","ok","n","pattern","consume","caseInsensitive","cased","str","substr","inner","dialogDiv","template","bottom","wrap","dialog","closeNotification","newVal","callback","closed","me","close","inp","button","doneTimer","duration","transformCursor","vim","updateSelectionForSurrogateCharacters","curStart","curEnd","charCode","defaultKeymap","defaultKeymapLength","defaultExCommandMap","enterVimMode","onCursorActivity","maybeInitVimState","getOnPasteFn","leaveVimMode","highlightTimeout","detachVimMap","next","attachVimMap","prev","cmKey","vimKey","cmKeyToVimKey","vimApi","modifiers","specialKeys","pieces","lastPiece","hasCharacter","piece","isUpperCase","offsetCursor","actions","numberRegex","wordCharTest","bigWordCharTest","makeKeyRange","size","keys","upperCaseAlphabet","lowerCaseAlphabet","numbers","validMarks","validRegisters","upperCaseChars","isLine","isLowerCase","k","isMatchableSymbol","isNumber","isWhiteSpaceString","isEndOfSentenceSymbol","inArray","arr","defineOption","defaultValue","type","aliases","setOption","value","cfg","option","scope","getOption","local","createCircularJumpList","pointer","tail","buffer","add","oldCur","newCur","current","curMark","useNextSlot","trashMark","markPos","cursorEqual","move","offset","mark","inc","find","oldPointer","createInsertModeChanges","c","MacroModeState","macroModeState","vimGlobalState","registerName","register","dom","InputState","resetVimGlobalState","RegisterController","HistoryController","optionName","lastInsertModeKeyTimer","InsertModeKey","lhs","rhs","ctx","exCommandDispatcher","toCtxArray","ctxsToMap","actualLength","origLength","mapping","newMapping","mappedCtxs","el","userKeymap","contexts","j","prefix","func","exCommands","origin","command","multiSelectHandleKey","handleMacroRecording","clearInputState","logKey","handleEsc","exitVisualMode","exitInsertMode","doKeyToKey","handleKeyInsertMode","keysAreChars","commandDispatcher","thisMatch","selections","here","handleKeyNonInsertMode","keysMatcher","context","mainKey","input","defineMotion","defineAction","defineOperator","mapCommand","_mapCommand","defineRegister","repeat","reason","Register","linewise","blockwise","changes","registers","operator","append","up","historyBuffer","element","keyMap","inputState","matches","commandMatches","bestMatch","character","lastChar","copyArgs","updateCmSelection","visualMode","operatorMotionArgs","repeatIsExplicit","actionArgs","forward","wholeWordOnly","getSearchState","promptPrefix","originalQuery","originalScrollPos","handleQuery","ignoreCase","smartCase","updateSearchQuery","showConfirm","onPromptClose","logSearchQuery","onPromptKeyUp","keyName","parsedQuery","findNext","clearSearchHighlight","onPromptKeyDown","showPrompt","word","expandWordUnderCursor","isKeyword","escapeRegex","motion","motionArgs","operatorArgs","origHead","copyCursor","clipCursorToContent","origAnchor","oldHead","oldAnchor","newHead","newAnchor","motionResult","motions","jumpList","cachedCursor","recordJumpPosition","updateMark","cursorIsBefore","lastSel","lineOffset","chOffset","cmSel","cursorMin","cursorMax","newPositions","makeCmSelection","lineLength","tmp","expandSelectionToLine","clipToLine","exclusive","operatorMoveTo","operators","actionCommand","_head","getUserVisibleLines","findFirstNonWhiteSpaceCharacter","_cm","cur","state","highlightSearchMatches","prevInputState","findNextFromAndToInclusive","from","to","getMarkPos","best","isWrongDirection","equal","between","cursorIsBetween","endCh","first","moveToEol","fold","res","lastCharCoords","goalCoords","resCoords","findParagraph","findSentence","scrollbox","orig","dest","moveToWord","moveToCharacter","recordLastCharacterSearch","findSymbol","moveToColumn","lineText","symbol","style","matched","lineNum","mirroredPairs","selfPaired","inclusive","selectCompanionObject","findBeginningAndEnd","expandTagUnderCursor","content","getSentence","expandSelection","lastSearch","fillArray","times","args","finalHead","replacement","lastState","prevLineEnd","wasLastLine","startLine","endLine","_args","swapped","toLower","toSwap","endPos","lineHeight","newPos","cursorCoords","newBottom","charCoords","height","lineLastCharPos","lineLastCharCoords","executeMacroRegister","insertAt","newPosition","getLastEditPos","onChange","onKeyEventTargetKeyDown","selectForInsert","_actionArgs","lastSelection","updateLastSelection","finalCh","nextStartCh","curFinalPos","newlineFn","_this","fallback","whitespaceLength","tabs","spaces","currentLine","indent","chompedText","wasChomped","firstIndent","wspace","newIndent","quotient","curPosFinal","idx","lastSelectionCurEnd","selectedArea","getSelectedAreaRange","selectionStart","selectionEnd","selectedText","emptyStrings","selectBlock","lastCh","extendLineToColumn","repeatFn","markName","replaceWith","replaceTo","replaceWithStr","lineStr","numberStr","baseStr","digits","base","number","zeroPadding","lastEditInputState","repeatLastEdit","includeLineBreak","maxCh","direction","ret","prop","offsetLine","offsetCh","partial","full","commandMatch","pressed","mapped","prefixLen","pressedPrefix","mappedPrefix","selectedCharacter","cur1","cur2","cur3","cur1before2","cur2before3","trim","isClipped","curHead","getIndex","wasClipped","firstLine","lastLine","baseCh","headCh","newDir","lineHead","atAnchor","atHead","getCurrentSelectedAreaRange","getLastSelectedAreaRange","block","width","headOffset","anchorOffset","fromCh","toCh","primary","getHead","moveHead","selection","lines","firstNonWS","_forward","bigWord","noSymbol","test","wordEnd","wordStart","tags","symbolToMode","findSymbolModes","symb","curCh","init","isComplete","lineLen","findWord","emptyLineIsWord","charTests","stop","foundWord","words","eodCh","shortCircuit","firstWord","lastWord","keepHPos","retval","charIdxInLine","includeChar","isEmpty","isBoundary","any","skipFold","foldLine","startState","nextChar","curr","ln","lastSentencePos","reverse","curr_index","last_valid","skip_empty_lines","bracketRegexp","openSym","curChar","chars","len","firstIndex","SearchState","overlay","reversed","annotate","splitBySlash","argString","splitBySeparator","findUnescapedSlashes","findUnescapedSeparators","separator","slashes","tokens","escapeNextChar","translateRegex","specials","unescape","out","specialComesNext","charUnescapes","translateRegexReplace","unescapes","unescapeRegexReplace","stream","output","matcher","parseQuery","lastSearchRegister","regexPart","forceIgnoreCase","flagsPart","regexp","pre","makePrompt","desc","shortText","regexEqual","r1","r2","props","rawQuery","searchOverlay","matchSol","searchState","lastEndPos","isInRange","undoManager","ExCommandDispatcher","opt_params","that","commandHistoryRegister","previousCommand","inputStream","params","commandName","numberMatch","offsetMatch","delim","mapArgs","setArgs","setCfg","expr","forceGet","optionIsBoolean","oldValue","setOptionReturn","regArgs","regInfo","unique","parseArgs","opts","decimal","hex","octal","err","lineStart","lineEnd","radix","numPart","textPart","matchPart","compareFn","b","anum","bnum","comparePatternFn","textOld","inverted","matchedLines","nextCommand","replacePart","trailing","count","confirm","global","startPos","doReplace","sym","startMark","finishMark","finish","searchCursor","done","lastPos","modifiedLineNumber","joined","replaceAll","replace","newText","unmodifiedLineNumber","findNextValidMatch","lastMatchTo","_value","savedCallback","insertModeChangeRegister","isPlaying","lastChange","logInsertModeChange","extra","keyBuffer","imc","repeatInsertModeChanges","changeObj","selectionCount","handleExternalSelection","onKeyFound","repeatForInsert","isAction","cachedInputState","repeatCommand","repeatInsert","changeObject","keyHandler","binding","visualBlock","specialKey","hashId","handleKey","cloneVimState","isHandled","wasMultiselect","old","getVim","pixelPos","w","left","isbackwards","data","keyCode","insertMode","updateInputMode","isIntsert","status","delayedExecAceCommand"],"mappings":"kbAAA,IAAI,OAAO,mBAAmB,CAAC,UAAU,UAAU,SAAS,YAAY,aAAa,YAAY,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