芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/timucuy2124.gob.mx/media/vendor/codemirror/keymap/vim.min.js
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}((function(e){"use strict";var t=[{keys:"
",type:"keyToKey",toKeys:"h"},{keys:"
",type:"keyToKey",toKeys:"l"},{keys:"
",type:"keyToKey",toKeys:"k"},{keys:"
",type:"keyToKey",toKeys:"j"},{keys:"
",type:"keyToKey",toKeys:"l"},{keys:"
",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"
",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"
",type:"keyToKey",toKeys:"W"},{keys:"
",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"
",type:"keyToKey",toKeys:"w"},{keys:"
",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"
",type:"keyToKey",toKeys:"j"},{keys:"
",type:"keyToKey",toKeys:"k"},{keys:"
",type:"keyToKey",toKeys:"
"},{keys:"
",type:"keyToKey",toKeys:"
"},{keys:"
",type:"keyToKey",toKeys:"
",context:"insert"},{keys:"
",type:"keyToKey",toKeys:"
",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"
",type:"keyToKey",toKeys:"0"},{keys:"
",type:"keyToKey",toKeys:"$"},{keys:"
",type:"keyToKey",toKeys:"
"},{keys:"
",type:"keyToKey",toKeys:"
"},{keys:"
",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"
",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"
",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"
",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"
",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"
",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f
",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F
",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t
",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T
",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'
",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`
",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]
",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[
",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"
",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"
",type:"idle",context:"normal"},{keys:"
",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"
",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"
",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"
",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"
",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"
",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r
",type:"action",action:"replace",isEdit:!0},{keys:"@
",type:"action",action:"replayMacro"},{keys:"q
",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"
",type:"action",action:"redo"},{keys:"m
",type:"action",action:"setMark"},{keys:'"
',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z
",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"
",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"
",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"
",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"
",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a
",type:"motion",motion:"textObjectManipulation"},{keys:"i
",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],r=t.length,n=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"global",shortName:"g"}],o=e.Pos;e.Vim=function(){function i(t,r){this==e.keyMap.vim&&(e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==t.getOption("inputStyle")&&null!=document.body.style.caretColor&&(!function(e){l(e),e.off("cursorActivity",s),e.state.fatCursorMarks=null}(t),t.getInputField().style.caretColor="")),r&&r.attach==a||function(t){t.setOption("disableInput",!1),t.off("cursorActivity",tt),e.off(t.getInputField(),"paste",p(t)),t.state.vim=null}(t)}function a(t,r){this==e.keyMap.vim&&(e.addClass(t.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==t.getOption("inputStyle")&&null!=document.body.style.caretColor&&(!function(e){e.state.fatCursorMarks=[],s(e),e.on("cursorActivity",s)}(t),t.getInputField().style.caretColor="transparent")),r&&r.attach==a||function(t){t.setOption("disableInput",!0),t.setOption("showCursorWhenSelecting",!1),e.signal(t,"vim-mode-change",{mode:"normal"}),t.on("cursorActivity",tt),_(t),e.on(t.getInputField(),"paste",p(t))}(t)}function s(e){if(e.state.fatCursorMarks){l(e);for(var t=e.listSelections(),r=[],n=0;n
"}(t);if(!n)return!1;var o=e.Vim.findKey(r,n);return"function"==typeof o&&e.signal(r,"vim-keypress",n),o}}e.defineOption("vimMode",!1,(function(t,r,n){r&&"vim"!=t.getOption("keyMap")?t.setOption("keyMap","vim"):!r&&n!=e.Init&&/^vim/.test(t.getOption("keyMap"))&&t.setOption("keyMap","default")}));var u={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},h={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function p(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(Y(e.getCursor(),0,1)),X.enterInsertMode(e,{},t))}),t.onPasteFn}var f=/[\d]/,d=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],m=[function(e){return/\S/.test(e)}];function g(e,t){for(var r=[],n=e;n
"]),x=[].concat(y,k,C,["-",'"',".",":","_","/"]);try{v=new RegExp("^[\\p{Lu}]$","u")}catch(e){v=/^[A-Z]$/}function M(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function S(e){return/^[a-z]$/.test(e)}function A(e){return v.test(e)}function b(e){return/^\s*$/.test(e)}function L(e){return-1!=".?!".indexOf(e)}function T(e,t){for(var r=0;r
r?t=r:t
0?1:-1,u=i.getCursor();do{if((s=o[(e+(t+=c))%e])&&(l=s.find())&&!ne(u,l))break}while(t
n)}return s}return{cachedCursor:void 0,add:function(i,a,s){var l=o[t%e];function c(r){var n=++t%e,a=o[n];a&&a.clear(),o[n]=i.setBookmark(r)}if(l){var u=l.find();u&&!ne(u,a)&&c(a)}else c(a);c(s),r=t,(n=t-e+1)<0&&(n=0)},find:function(e,r){var n=t,o=i(e,r);return t=n,o&&o.find()},move:i}},P=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function j(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=P()}function _(e){return e.state.vim||(e.state.vim={inputState:new W,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function H(){for(var e in I={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:K(),macroModeState:new j,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new $({}),searchHistoryController:new U,exCommandHistoryController:new U},R){var t=R[e];t.value=t.defaultValue}}j.prototype={exitMacroRecordMode:function(){var e=I.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=I.registerController.getRegister(t);r&&(r.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog(document.createTextNode("(recording)["+t+"]"),null,{bottom:!0})),this.isRecording=!0)}};var F={buildKeyMap:function(){},getRegisterController:function(){return I.registerController},resetVimGlobalState_:H,getVimGlobalState_:function(){return I},maybeInitVimState_:_,suppressErrorLogging:!1,InsertModeKey:ot,map:function(e,t,r){Xe.map(e,t,r)},unmap:function(e,t){Xe.unmap(e,t)},noremap:function(e,n,o){function i(e){return e?[e]:["normal","insert","visual"]}for(var a=i(o),s=t.length,l=s-r;l
=0;a--){var s=i[a];if(e!==s.context)if(s.context)this._mapCommand(s);else{var l=["normal","insert","visual"];for(var c in l)if(l[c]!==e){var u={};for(var h in s)u[h]=s[h];u.context=l[c],this._mapCommand(u)}}}},setOption:O,getOption:B,defineOption:E,defineEx:function(e,t,r){if(t){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered')}else t=e;ze[e]=r,Xe.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if("function"==typeof n)return n()},findKey:function(r,n,o){var i,a=_(r);function s(){var e=I.macroModeState;if(e.isRecording){if("q"==n)return e.exitMacroRecordMode(),D(r),!0;"mapping"!=o&&function(e,t){if(e.isPlaying)return;var r=e.latestRegister,n=I.registerController.getRegister(r);n&&n.pushText(t)}(e,n)}}function l(){if("
"==n)return D(r),a.visualMode?ge(r):a.insertMode&&Ze(r),!0}return!1===(i=a.insertMode?function(){if(l())return!0;for(var e=a.inputState.keyBuffer=a.inputState.keyBuffer+n,o=1==n.length,i=J.matchCommand(e,t,a.inputState,"insert");e.length>1&&"full"!=i.type;){e=a.inputState.keyBuffer=e.slice(1);var s=J.matchCommand(e,t,a.inputState,"insert");"none"!=s.type&&(i=s)}if("none"==i.type)return D(r),!1;if("partial"==i.type)return N&&window.clearTimeout(N),N=window.setTimeout((function(){a.insertMode&&a.inputState.keyBuffer&&D(r)}),B("insertModeEscKeysTimeout")),!o;if(N&&window.clearTimeout(N),o){for(var c=r.listSelections(),u=0;u
|<\w+>|./.exec(t),n=o[0],t=t.substring(o.index+n.length),e.Vim.handleKey(r,n,"mapping")}(i.toKeys):J.processCommand(r,a,i)}catch(t){throw r.state.vim=void 0,_(r),e.Vim.suppressErrorLogging||console.log(t),t}return!0}))}},handleEx:function(e,t){Xe.processCommand(e,t)},defineMotion:function(e,t){q[e]=t},defineAction:function(e,t){X[e]=t},defineOperator:function(e,t){z[e]=t},mapCommand:function(e,t,r,n,o){var i={keys:e,type:t};for(var a in i[t]=r,i[t+"Args"]=n,o)i[a]=o[a];Ge(i)},_mapCommand:Ge,defineRegister:function(e,t){var r=I.registerController.registers;if(!e||1!=e.length)throw Error("Register name must be 1 character");if(r[e])throw Error("Register already defined "+e);r[e]=t,x.push(e)},exitVisualMode:ge,exitInsertMode:Ze};function W(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function D(t,r){t.state.vim.inputState=new W,e.signal(t,"vim-command-done",r)}function V(e,t,r){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!r}function $(e){this.registers=e,this.unnamedRegister=e['"']=new V,e["."]=new V,e[":"]=new V,e["/"]=new V}function U(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}W.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},W.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e},V.prototype={setText:function(e,t,r){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!r},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(P(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},$.prototype={pushText:function(e,t,r,n,o){if("_"!==e){n&&"\n"!==r.charAt(r.length-1)&&(r+="\n");var i=this.isValidRegister(e)?this.getRegister(e):null;if(i){A(e)?i.pushText(r,n):i.setText(r,n,o),this.unnamedRegister.setText(i.toString(),n)}else{switch(t){case"yank":this.registers[0]=new V(r,n,o);break;case"delete":case"change":-1==r.indexOf("\n")?this.registers["-"]=new V(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new V(r,n))}this.unnamedRegister.setText(r,n,o)}}},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new V),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&T(e,x)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},U.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var o=this.iterator+n;t?o>=0:o
=r.length?(this.iterator=r.length,this.initialPrefix):o<0?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var J={matchCommand:function(e,t,r,n){var o,i=function(e,t,r,n){for(var o,i=[],a=[],s=0;s
"==o.keys.slice(-11)){var l=function(e){var t=/^.*(<[^>]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"
":r="\n";break;case"
":r=" ";break;default:r=""}return r}(e);if(!l)return{type:"none"};r.selectedCharacter=l}return{type:"full",command:o}},processCommand:function(e,t,r){switch(t.inputState.repeatOverride=r.repeatOverride,r.type){case"motion":this.processMotion(e,t,r);break;case"operator":this.processOperator(e,t,r);break;case"operatorMotion":this.processOperatorMotion(e,t,r);break;case"action":this.processAction(e,t,r);break;case"search":this.processSearch(e,t,r);break;case"ex":case"keyToEx":this.processEx(e,t,r)}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=G(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator){if(n.operator==r.operator)return n.motion="expandToLine",n.motionArgs={linewise:!0},void this.evalInput(e,t);D(e)}n.operator=r.operator,n.operatorArgs=G(r.operatorArgs),r.exitVisualBlock&&(t.visualBlock=!1,de(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,o=G(r.operatorMotionArgs);o&&n&&o.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,o=n.getRepeat(),i=!!o,a=G(r.actionArgs)||{};n.selectedCharacter&&(a.selectedCharacter=n.selectedCharacter),r.operator&&this.processOperator(e,t,r),r.motion&&this.processMotion(e,t,r),(r.motion||r.operator)&&this.evalInput(e,t),a.repeat=o||1,a.repeatIsExplicit=i,a.registerName=n.registerName,D(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),X[r.action](e,a,t)},processSearch:function(t,r,n){if(t.getSearchCursor){var o=n.searchArgs.forward,i=n.searchArgs.wholeWordOnly;Ee(t).setReversed(!o);var a=o?"/":"?",s=Ee(t).getQuery(),l=t.getScrollInfo();switch(n.searchArgs.querySrc){case"prompt":var c=I.macroModeState;if(c.isPlaying)f(p=c.replaySearchQueries.shift(),!0,!1);else _e(t,{onClose:function(e){t.scrollTo(l.left,l.top),f(e,!0,!0);var r=I.macroModeState;r.isRecording&&function(e,t){if(!e.isPlaying){var r=e.latestRegister,n=I.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}(r,e)},prefix:a,desc:"(JavaScript regexp)",onKeyUp:function(r,n,i){var a,s,c,u=e.keyName(r);"Up"==u||"Down"==u?(a="Up"==u,s=r.target?r.target.selectionEnd:0,i(n=I.searchHistoryController.nextMatch(n,a)||""),s&&r.target&&(r.target.selectionEnd=r.target.selectionStart=Math.min(s,r.target.value.length))):"Left"!=u&&"Right"!=u&&"Ctrl"!=u&&"Alt"!=u&&"Shift"!=u&&I.searchHistoryController.reset();try{c=He(t,n,!0,!0)}catch(r){}c?t.scrollIntoView(De(t,!o,c),30):(Ve(t),t.scrollTo(l.left,l.top))},onKeyDown:function(r,n,o){var i=e.keyName(r);"Esc"==i||"Ctrl-C"==i||"Ctrl-["==i||"Backspace"==i&&""==n?(I.searchHistoryController.pushInput(n),I.searchHistoryController.reset(),He(t,s),Ve(t),t.scrollTo(l.left,l.top),e.e_stop(r),D(t),o(),t.focus()):"Up"==i||"Down"==i?e.e_stop(r):"Ctrl-U"==i&&(e.e_stop(r),o(""))}});break;case"wordUnderCursor":var u=ye(t,!1,!0,!1,!0),h=!0;if(u||(u=ye(t,!1,!0,!1,!1),h=!1),!u)return;var p=t.getLine(u.start.line).substring(u.start.ch,u.end.ch);p=h&&i?"\\b"+p+"\\b":p.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),I.jumpList.cachedCursor=t.getCursor(),t.setCursor(u.start),f(p,!0,!1)}}function f(e,o,i){I.searchHistoryController.pushInput(e),I.searchHistoryController.reset();try{He(t,e,o,i)}catch(r){return je(t,"Invalid regex: "+e),void D(t)}J.processMotion(t,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:n.searchArgs.toJumplist}})}},processEx:function(t,r,n){function o(e){I.exCommandHistoryController.pushInput(e),I.exCommandHistoryController.reset(),Xe.processCommand(t,e)}function i(r,n,o){var i,a,s=e.keyName(r);("Esc"==s||"Ctrl-C"==s||"Ctrl-["==s||"Backspace"==s&&""==n)&&(I.exCommandHistoryController.pushInput(n),I.exCommandHistoryController.reset(),e.e_stop(r),D(t),o(),t.focus()),"Up"==s||"Down"==s?(e.e_stop(r),i="Up"==s,a=r.target?r.target.selectionEnd:0,o(n=I.exCommandHistoryController.nextMatch(n,i)||""),a&&r.target&&(r.target.selectionEnd=r.target.selectionStart=Math.min(a,r.target.value.length))):"Ctrl-U"==s?(e.e_stop(r),o("")):"Left"!=s&&"Right"!=s&&"Ctrl"!=s&&"Alt"!=s&&"Shift"!=s&&I.exCommandHistoryController.reset()}"keyToEx"==n.type?Xe.processCommand(t,n.exArgs.input):r.visualMode?_e(t,{onClose:o,prefix:":",value:"'<,'>",onKeyDown:i,selectValueOnOpen:!1}):_e(t,{onClose:o,prefix:":",onKeyDown:i})},evalInput:function(e,t){var r,n,i,a=t.inputState,s=a.motion,l=a.motionArgs||{},c=a.operator,u=a.operatorArgs||{},h=a.registerName,p=t.sel,f=re(t.visualMode?Z(e,p.head):e.getCursor("head")),d=re(t.visualMode?Z(e,p.anchor):e.getCursor("anchor")),m=re(f),g=re(d);if(c&&this.recordLastEdit(t,a),(i=void 0!==a.repeatOverride?a.repeatOverride:a.getRepeat())>0&&l.explicitRepeat?l.repeatIsExplicit=!0:(l.noRepeat||!l.explicitRepeat&&0===i)&&(i=1,l.repeatIsExplicit=!1),a.selectedCharacter&&(l.selectedCharacter=u.selectedCharacter=a.selectedCharacter),l.repeat=i,D(e),s){var v=q[s](e,f,l,t,a);if(t.lastMotion=q[s],!v)return;if(l.toJumplist){var y=I.jumpList,k=y.cachedCursor;k?(ke(e,k,v),delete y.cachedCursor):ke(e,f,v)}v instanceof Array?(n=v[0],r=v[1]):r=v,r||(r=re(f)),t.visualMode?(t.visualBlock&&r.ch===1/0||(r=Z(e,r)),n&&(n=Z(e,n)),n=n||g,p.anchor=n,p.head=r,de(e),be(e,t,"<",oe(n,r)?n:r),be(e,t,">",oe(n,r)?r:n)):c||(r=Z(e,r),e.setCursor(r.line,r.ch))}if(c){if(u.lastSel){n=g;var C=u.lastSel,w=Math.abs(C.head.line-C.anchor.line),x=Math.abs(C.head.ch-C.anchor.ch);r=C.visualLine?o(g.line+w,g.ch):C.visualBlock?o(g.line+w,g.ch+x):C.head.line==C.anchor.line?o(g.line,g.ch+x):o(g.line+w,g.ch),t.visualMode=!0,t.visualLine=C.visualLine,t.visualBlock=C.visualBlock,p=t.sel={anchor:n,head:r},de(e)}else t.visualMode&&(u.lastSel={anchor:re(p.anchor),head:re(p.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var M,S,A,L,T;if(t.visualMode){if(M=ie(p.head,p.anchor),S=ae(p.head,p.anchor),A=t.visualLine||u.linewise,T=me(e,{anchor:M,head:S},L=t.visualBlock?"block":A?"line":"char"),A){var R=T.ranges;if("block"==L)for(var E=0;E
0&&i&&b(i);i=o.pop())r.line--,r.ch=0;i?(r.line--,r.ch=le(e,r.line)):r.ch=0}}(e,M,S),T=me(e,{anchor:M,head:S},L="char",!l.inclusive||A)}e.setSelections(T.ranges,T.primary),t.lastMotion=null,u.repeat=i,u.registerName=h,u.linewise=A;var B=z[c](e,u,T.ranges,g,r);t.visualMode&&ge(e,null!=B),B&&e.setCursor(B)}},recordLastEdit:function(e,t,r){var n=I.macroModeState;n.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=r,n.lastInsertModeChanges.changes=[],n.lastInsertModeChanges.expectCursorActivityForChange=!1,n.lastInsertModeChanges.visualBlock=e.visualBlock?e.sel.head.line-e.sel.anchor.line:0)}},q={moveToTopLine:function(e,t,r){var n=Ue(e).top+r.repeat-1;return o(n,ve(e.getLine(n)))},moveToMiddleLine:function(e){var t=Ue(e),r=Math.floor(.5*(t.top+t.bottom));return o(r,ve(e.getLine(r)))},moveToBottomLine:function(e,t,r){var n=Ue(e).bottom-r.repeat+1;return o(n,ve(e.getLine(n)))},expandToLine:function(e,t,r){return o(t.line+r.repeat-1,1/0)},findNext:function(e,t,r){var n=Ee(e),o=n.getQuery();if(o){var i=!r.forward;return i=n.isReversed()?!i:i,We(e,o),De(e,i,o,r.repeat)}},findAndSelectNextInclusive:function(t,r,n,i,a){var s=Ee(t),l=s.getQuery();if(l){var c=!n.forward,u=function(e,t,r,n,i){void 0===n&&(n=1);return e.operation((function(){var a=e.getCursor(),s=e.getSearchCursor(r,a),l=s.find(!t);!i.visualMode&&l&&ne(s.from(),a)&&s.find(!t);for(var c=0;c
l:h.line
u&&i.line==u?Se(e,t,r,n,!0):(r.toFirstChar&&(a=ve(e.getLine(l)),n.lastHPos=a),n.lastHSPos=e.charCoords(o(l,a),"div").left,o(l,a))},moveByDisplayLines:function(e,t,r,n){var i=t;switch(n.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:n.lastHSPos=e.charCoords(i,"div").left}var a=r.repeat;if((l=e.findPosV(i,r.forward?a:-a,"line",n.lastHSPos)).hitSide)if(r.forward)var s={top:e.charCoords(l,"div").top+8,left:n.lastHSPos},l=e.coordsChar(s,"div");else{var c=e.charCoords(o(e.firstLine(),0),"div");c.left=n.lastHSPos,l=e.coordsChar(c,"div")}return n.lastHPos=l.ch,l},moveByPage:function(e,t,r){var n=t,o=r.repeat;return e.findPosV(n,r.forward?o:-o,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return Te(e,t,r.repeat,n)},moveBySentence:function(e,t,r){var n=r.forward?1:-1;return function(e,t,r,n){function i(e,t){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!M(e,t.ln))return t.line=null,t.ln=null,void(t.pos=null);t.line=e.getLine(t.ln),t.pos=t.dir>0?0:t.line.length-1}else t.pos+=t.dir}function a(e,t,r,n){var o=""===(c=e.getLine(t)),a={line:c,ln:t,pos:r,dir:n},s={ln:a.ln,pos:a.pos},l=""===a.line;for(i(e,a);null!==a.line;){if(s.ln=a.ln,s.pos=a.pos,""===a.line&&!l)return{ln:a.ln,pos:a.pos};if(o&&""!==a.line&&!b(a.line[a.pos]))return{ln:a.ln,pos:a.pos};!L(a.line[a.pos])||o||a.pos!==a.line.length-1&&!b(a.line[a.pos+1])||(o=!0),i(e,a)}var c=e.getLine(s.ln);s.pos=0;for(var u=c.length-1;u>=0;--u)if(!b(c[u])){s.pos=u;break}return s}function s(e,t,r,n){var o={line:l=e.getLine(t),ln:t,pos:r,dir:n},a={ln:o.ln,pos:null},s=""===o.line;for(i(e,o);null!==o.line;){if(""===o.line&&!s)return null!==a.pos?a:{ln:o.ln,pos:o.pos};if(L(o.line[o.pos])&&null!==a.pos&&(o.ln!==a.ln||o.pos+1!==a.pos))return a;""===o.line||b(o.line[o.pos])||(s=!1,a={ln:o.ln,pos:o.pos}),i(e,o)}var l=e.getLine(a.ln);a.pos=0;for(var c=0;c
0;)l=n<0?s(e,l.ln,l.pos,n):a(e,l.ln,l.pos,n),r--;return o(l.ln,l.pos)}(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var o=e.getScrollInfo(),i=null,a=r.repeat;a||(a=o.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");if(r.repeat=a,!(i=q.moveByDisplayLines(e,t,r,n)))return null;var l=e.charCoords(i,"local");return e.scrollTo(null,o.top+l.top-s.top),i},moveByWords:function(e,t,r){return function(e,t,r,n,i,a){var s=re(t),l=[];(n&&!i||!n&&i)&&r++;for(var c=!(n&&i),u=0;u
0)h.index=0;else{var m=h.lineText.length;h.index=m>0?m-1:0}h.nextCh=h.lineText.charAt(h.index)}d(h)&&(i.line=c,i.ch=h.index,t--)}if(h.nextCh||h.curMoveThrough)return o(c,h.index);return i}(e,r.repeat,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,n){var i=r.repeat;return n.lastHPos=i-1,n.lastHSPos=e.charCoords(t,"div").left,function(e,t){var r=e.getCursor().line;return Z(e,o(r,t-1))}(e,i)},moveToEol:function(e,t,r,n){return Se(e,t,r,n,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,t){var r=t;return o(r.line,ve(e.getLine(r.line)))},moveToMatchedSymbol:function(e,t){for(var r,n=t,i=n.line,a=n.ch,s=e.getLine(i);a
"===a?/[(){}[\]<>]/:/[(){}[\]]/;return e.findMatchingBracket(o(i,a),{bracketRegex:c}).to}return n},moveToStartOfLine:function(e,t){return o(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var n=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(n=r.repeat-e.getOption("firstLineNumber")),o(n,ve(e.getLine(n)))},textObjectManipulation:function(t,r,n,i){var a=n.selectedCharacter;"b"==a?a="(":"B"==a&&(a="{");var s,l=!n.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"}[a])s=function(e,t,r,n){var i,a,s=t,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[r],u=e.getLine(s.line).charAt(s.ch)===c?1:0;if(i=e.scanForBracket(o(s.line,s.ch+u),-1,void 0,{bracketRegex:l}),a=e.scanForBracket(o(s.line,s.ch+u),1,void 0,{bracketRegex:l}),!i||!a)return{start:s,end:s};if(i=i.pos,a=a.pos,i.line==a.line&&i.ch>a.ch||i.line>a.line){var h=i;i=a,a=h}n?a.ch+=1:i.ch+=1;return{start:i,end:a}}(t,r,a,l);else if({"'":!0,'"':!0,"`":!0}[a])s=function(e,t,r,n){var i,a,s,l,c=re(t),u=e.getLine(c.line).split(""),h=u.indexOf(r);c.ch
-1&&!i;s--)u[s]==r&&(i=s+1);else i=c.ch+1;if(i&&!a)for(s=i,l=u.length;s
t.lastLine()&&r.linewise&&!d?t.replaceRange("",f,c):t.replaceRange("",l,c),r.linewise&&(d||(t.setCursor(f),e.commands.newlineAndIndent(t)),l.ch=Number.MAX_VALUE),i=l}I.registerController.pushText(r.registerName,"change",a,r.linewise,n.length>1),X.enterInsertMode(t,{head:i},t.state.vim)},delete:function(e,t,r){var n,i,a=e.state.vim;if(a.visualBlock){i=e.getSelection();var s=Q("",r.length);e.replaceSelections(s),n=r[0].anchor}else{var l=r[0].anchor,c=r[0].head;t.linewise&&c.line!=e.firstLine()&&l.line==e.lastLine()&&l.line==c.line-1&&(l.line==e.firstLine()?l.ch=0:l=o(l.line-1,le(e,l.line-1))),i=e.getRange(l,c),e.replaceRange("",l,c),n=l,t.linewise&&(n=q.moveToFirstNonWhiteSpaceCharacter(e,l))}return I.registerController.pushText(t.registerName,"delete",i,t.linewise,a.visualBlock),Z(e,n)},indent:function(e,t,r){var n=e.state.vim,o=r[0].anchor.line,i=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,a=n.visualMode?t.repeat:1;t.linewise&&i--;for(var s=o;s<=i;s++)for(var l=0;l
c.top?(l.line+=(s-c.top)/o,l.line=Math.ceil(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.top)):e.scrollTo(null,s);else{var u=s+e.getScrollInfo().clientHeight;u
=a.anchor.line?Y(a.head,0,1):o(a.anchor.line,0)}else if("inplace"==i){if(n.visualMode)return}else"lastEdit"==i&&(s=qe(t)||s);t.setOption("disableInput",!1),r&&r.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),I.macroModeState.isPlaying||(t.on("change",et),e.on(t.getInputField(),"keydown",it)),n.visualMode&&ge(t),pe(t,s,l)}},toggleVisualMode:function(t,r,n){var i,a=r.repeat,s=t.getCursor();n.visualMode?n.visualLine^r.linewise||n.visualBlock^r.blockwise?(n.visualLine=!!r.linewise,n.visualBlock=!!r.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""}),de(t)):ge(t):(n.visualMode=!0,n.visualLine=!!r.linewise,n.visualBlock=!!r.blockwise,i=Z(t,o(s.line,s.ch+a-1)),n.sel={anchor:s,head:i},e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""}),de(t),be(t,n,"<",ie(s,i)),be(t,n,">",ae(s,i)))},reselectLastSelection:function(t,r,n){var o=n.lastSelection;if(n.visualMode&&fe(t,n),o){var i=o.anchorMark.find(),a=o.headMark.find();if(!i||!a)return;n.sel={anchor:i,head:a},n.visualMode=!0,n.visualLine=o.visualLine,n.visualBlock=o.visualBlock,de(t),be(t,n,"<",ie(i,a)),be(t,n,">",ae(i,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var n,i;if(r.visualMode){if(n=e.getCursor("anchor"),oe(i=e.getCursor("head"),n)){var a=i;i=n,n=a}i.ch=le(e,i.line)-1}else{var s=Math.max(t.repeat,2);n=e.getCursor(),i=Z(e,o(n.line+s-1,1/0))}for(var l=0,c=n.line;c
1)f=Array(t.repeat+1).join(f);var d,m,g=i.linewise,v=i.blockwise;if(v){f=f.split("\n"),g&&f.pop();for(var y=0;y
e.lastLine()&&e.replaceRange("\n",o(b,0)),le(e,b)
u.length&&(i=u.length),a=o(l.line,i)}if("\n"==s)n.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var h=t.getRange(l,a);if(h=h.replace(/[^\n]/g,s),n.visualBlock){var p=new Array(t.getOption("tabSize")+1).join(" ");h=(h=t.getSelection()).replace(/\t/g,p).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(h)}else t.replaceRange(h,l,a);n.visualMode?(l=oe(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),ge(t,!1)):t.setCursor(Y(a,0,-1))}},incrementNumberToken:function(e,t){for(var r,n,i,a,s=e.getCursor(),l=e.getLine(s.line),c=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;null!==(r=c.exec(l))&&(i=(n=r.index)+r[0].length,!(s.ch
"==t.slice(-11)){var r=t.length-11,n=e.slice(0,r),o=t.slice(0,r);return n==o&&e.length>r?"full":0==o.indexOf(n)&&"partial"}return e==t?"full":0==t.indexOf(e)&&"partial"}function te(e,t,r){return function(){for(var n=0;n
2&&(t=ie.apply(void 0,Array.prototype.slice.call(arguments,1))),oe(e,t)?e:t}function ae(e,t){return arguments.length>2&&(t=ae.apply(void 0,Array.prototype.slice.call(arguments,1))),oe(e,t)?t:e}function se(e,t,r){var n=oe(e,t),o=oe(t,r);return n&&o}function le(e,t){return e.getLine(t).length}function ce(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function ue(e,t,r){var n=le(e,t),i=new Array(r-n+1).join(" ");e.setCursor(o(t,n)),e.replaceRange(i,e.getCursor())}function he(e,t){var r=[],n=e.listSelections(),i=re(e.clipPos(t)),a=!ne(t,i),s=function(e,t,r){for(var n=0;n
s?c:0,h=n[u].anchor,p=Math.min(h.line,i.line),f=Math.max(h.line,i.line),d=h.ch,m=i.ch,g=n[u].head.ch-d,v=m-d;g>0&&v<=0?(d++,a||m--):g<0&&v>=0?(d--,l||m++):g<0&&-1==v&&(d--,m++);for(var y=p;y<=f;y++){var k={anchor:new o(y,d),head:new o(y,m)};r.push(k)}return e.setSelections(r),t.ch=m,h.ch=d,h}function pe(e,t,r){for(var n=[],o=0;o
c&&(i.line=c),i.ch=le(e,i.line)}return{ranges:[{anchor:a,head:i}],primary:0}}if("block"==r){for(var u=Math.min(a.line,i.line),h=Math.min(a.ch,i.ch),p=Math.max(a.line,i.line),f=Math.max(a.ch,i.ch)+1,d=p-u+1,m=i.line==u?0:d-1,g=[],v=0;v
=s.length)return null;n?c=m[0]:(c=d[0])(s.charAt(l))||(c=d[1]);for(var u=l,h=l;c(s.charAt(u))&&u
=0;)h--;if(h++,t){for(var p=u;/\s/.test(s.charAt(u))&&u
0;)h--;h||(h=f)}}return{start:o(a.line,h),end:o(a.line,u)}}function ke(e,t,r){ne(t,r)||I.jumpList.add(e,t,r)}function Ce(e,t){I.lastCharacterSearch.increment=e,I.lastCharacterSearch.forward=t.forward,I.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var we={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},xe={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return 0===e.index&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t="*"===e.lastCh&&"/"===e.nextCh;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb="m"===e.symb?"{":"}",e.reverseSymb="{"===e.symb?"}":"{"},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if("#"===e.nextCh){var t=e.lineText.match(/^#(\w+)/)[1];if("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};function Me(e,t,r,n,o){var i=t.line,a=t.ch,s=e.getLine(i),l=r?1:-1,c=n?m:d;if(o&&""==s){if(i+=l,s=e.getLine(i),!M(e,i))return null;a=r?0:s.length}for(;;){if(o&&""==s)return{from:0,to:0,line:i};for(var u=l>0?s.length:-1,h=u,p=u;a!=u;){for(var f=!1,g=0;g
0?0:s.length}}function Se(e,t,r,n,i){var a=o(t.line+r.repeat-1,1/0),s=e.clipPos(a);return s.ch--,i||(n.lastHPos=1/0,n.lastHSPos=e.charCoords(s,"div").left),a}function Ae(e,t,r,n){for(var i,a=e.getCursor(),s=a.ch,l=0;l
0;)p(u,n)&&r--,u+=n;return new o(u,0)}var f=e.state.vim;if(f.visualLine&&p(s,1,!0)){var d=f.sel.anchor;p(d.line,-1,!0)&&(i&&d.line==s||(s+=1))}var m=h(s);for(u=s;u<=c&&r;u++)p(u,1,!0)&&(i&&h(u)==m||r--);for(a=new o(u,0),u>c&&!m?m=!0:i=!1,u=s;u>l&&(i&&h(u)!=m&&u!=s||!p(u,-1,!0));u--);return{start:new o(u,0),end:a}}function Re(){}function Ee(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Re)}function Oe(e,t){var r=Be(e,t)||[];if(!r.length)return[];var n=[];if(0===r[0]){for(var o=0;o
=t&&e<=r:e==t}function Ue(e){var t=e.getScrollInfo(),r=e.coordsChar({left:0,top:6+t.top},"local"),n=t.clientHeight-10+t.top,o=e.coordsChar({left:0,top:n},"local");return{top:r.line,bottom:o.line}}function Je(e,t,r){if("'"==r||"`"==r)return I.jumpList.find(e,-1)||o(0,0);if("."==r)return qe(e);var n=t.marks[r];return n&&n.find()}function qe(e){for(var t=e.doc.history.done,r=t.length;r--;)if(t[r].changes)return re(t[r].changes[0].to)}var Qe=function(){this.buildCommandMap_()};Qe.prototype={processCommand:function(e,t,r){var n=this;e.operation((function(){e.curOp.isVimOp=!0,n._processCommand(e,t,r)}))},_processCommand:function(t,r,n){var o=t.state.vim,i=I.registerController.getRegister(":"),a=i.toString();o.visualMode&&ge(t);var s=new e.StringStream(r);i.setText(r);var l,c,u=n||{};u.input=r;try{this.parseInput_(t,s,u)}catch(e){throw je(t,e.toString()),e}if(u.commandName){if(l=this.matchCommand_(u.commandName)){if(c=l.name,l.excludeFromCommandHistory&&i.setText(a),this.parseCommandArgs_(s,u,l),"exToKey"==l.type){for(var h=0;h
@~])/);return r.commandName=n?n[1]:t.match(/.*/)[0],r},parseLineSpec_:function(e,t){var r=t.match(/^(\d+)/);if(r)return parseInt(r[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var n=t.next(),o=Je(e,e.state.vim,n);if(!o)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,o.line);case"-":case"+":return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:return void t.backUp(1)}},parseLineSpecOffset_:function(e,t){var r=e.match(/^([+-])?(\d+)/);if(r){var n=parseInt(r[2],10);"-"==r[1]?t-=n:t+=n}return t},parseCommandArgs_:function(e,t,r){if(!e.eol()){t.argString=e.match(/.*/)[0];var n=r.argDelimiter||/\s+/,o=ce(t.argString).split(n);o.length&&o[0]&&(t.args=o)}},matchCommand_:function(e){for(var t=e.length;t>0;t--){var r=e.substring(0,t);if(this.commandMap_[r]){var n=this.commandMap_[r];if(0===n.name.indexOf(e))return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e
1)return"Invalid arguments";s=(c?"decimal":u&&"hex")||h&&"octal"}o[2]&&(l=new RegExp(o[2].substr(1,o[2].length-2),i?"i":""))}}();if(c)je(t,c+": "+r.argString);else{var u=r.line||t.firstLine(),h=r.lineEnd||r.line||t.lastLine();if(u!=h){var p=o(u,0),f=o(h,le(t,h)),d=t.getRange(p,f).split("\n"),m=l||("decimal"==s?/(-?)([\d]+)/:"hex"==s?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==s?/([0-7]+)/:null),g="decimal"==s?10:"hex"==s?16:"octal"==s?8:null,v=[],y=[];if(s||l)for(var k=0;k
=u)return void je(t,"Invalid argument: "+r.argString.substring(i));for(var h=0;h<=u-c;h++){var p=String.fromCharCode(c+h);delete n.marks[p]}}else delete n.marks[a]}else je(t,"Argument required")}},Xe=new Qe;function Ze(t){var r=t.state.vim,n=I.macroModeState,o=I.registerController.getRegister("."),i=n.isPlaying,a=n.lastInsertModeChanges;i||(t.off("change",et),e.off(t.getInputField(),"keydown",it)),!i&&r.insertModeRepeat>1&&(at(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption("keyMap","vim"),t.setOption("disableInput",!0),t.toggleOverwrite(!1),o.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),n.isRecording&&function(e){if(e.isPlaying)return;var t=e.latestRegister,r=I.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}(n)}function Ge(e){t.unshift(e)}function Ye(t,r,n,o){var i=I.registerController.getRegister(o);if(":"==o)return i.keyBuffer[0]&&Xe.processCommand(t,i.keyBuffer[0]),void(n.isPlaying=!1);var a=i.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var l=0;l
|<\w+>|./.exec(h))[0],h=h.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),r.insertMode){var p=i.insertModeChanges[s++].changes;I.macroModeState.lastInsertModeChanges.changes=p,st(t,p,1),Ze(t)}n.isPlaying=!1}function et(e,t){var r=I.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,n.ignoreCount>1)n.ignoreCount--;else if("+input"==t.origin||"paste"==t.origin||void 0===t.origin){var o=e.listSelections().length;o>1&&(n.ignoreCount=o);var i=t.text.join("\n");n.maybeReset&&(n.changes=[],n.maybeReset=!1),i&&(e.state.overwrite&&!/\n/.test(i)?n.changes.push([i]):n.changes.push(i))}t=t.next}}function tt(t){var r=t.state.vim;if(r.insertMode){var n=I.macroModeState;if(n.isPlaying)return;var o=n.lastInsertModeChanges;o.expectCursorActivityForChange?o.expectCursorActivityForChange=!1:o.maybeReset=!0}else t.curOp.isVimOp||function(t,r){var n=t.getCursor("anchor"),o=t.getCursor("head");r.visualMode&&!t.somethingSelected()?ge(t,!1):r.visualMode||r.insertMode||!t.somethingSelected()||(r.visualMode=!0,r.visualLine=!1,e.signal(t,"vim-mode-change",{mode:"visual"}));if(r.visualMode){var i=oe(o,n)?0:-1,a=oe(o,n)?-1:0;o=Y(o,0,i),n=Y(n,0,a),r.sel={anchor:n,head:o},be(t,r,"<",ie(o,n)),be(t,r,">",ae(o,n))}else r.insertMode||(r.lastHPos=t.getCursor().ch)}(t,r);r.visualMode&&rt(t)}function rt(e){var t="cm-animate-fat-cursor",r=e.state.vim,n=Z(e,re(r.sel.head)),o=Y(n,0,1);if(nt(r),n.ch==e.getLine(n.line).length){var i=Pe("span",{class:t}," ");r.fakeCursorBookmark=e.setBookmark(n,{widget:i})}else r.fakeCursor=e.markText(n,o,{className:t})}function nt(e){e.fakeCursor&&(e.fakeCursor.clear(),e.fakeCursor=null),e.fakeCursorBookmark&&(e.fakeCursorBookmark.clear(),e.fakeCursorBookmark=null)}function ot(e){this.keyName=e}function it(t){var r=I.macroModeState.lastInsertModeChanges,n=e.keyName(t);n&&(-1==n.indexOf("Delete")&&-1==n.indexOf("Backspace")||e.lookupKey(n,"vim-insert",(function(){return r.maybeReset&&(r.changes=[],r.maybeReset=!1),r.changes.push(new ot(n)),!0})))}function at(e,t,r,n){var o=I.macroModeState;o.isPlaying=!0;var i=!!t.lastEditActionCommand,a=t.inputState;function s(){i?J.processAction(e,t,t.lastEditActionCommand):J.evalInput(e,t)}function l(r){if(o.lastInsertModeChanges.changes.length>0){r=t.lastEditActionCommand?r:1;var n=o.lastInsertModeChanges;st(e,n.changes,r)}}if(t.inputState=t.lastEditInputState,i&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;c