diff --git a/fhem/CHANGED b/fhem/CHANGED index 401b8a7b1..2c3e0ff84 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: fhem_codemirror: Added new codemirrorParams: + keyMap, jumpToLine, jumpToLine_extraKey - feature: 10_pilight_ctrl: NEW: protocol oregon_21 for temperature - deleted: 52_I2C_GY30_BH1750FVI: Arno Augustin hatte fast zeitgleich eine technisch bessere Variante entwickelt. Diese ist diff --git a/fhem/www/codemirror/fhem_codemirror.js b/fhem/www/codemirror/fhem_codemirror.js index 3961ddb63..97c8611b4 100644 --- a/fhem/www/codemirror/fhem_codemirror.js +++ b/fhem/www/codemirror/fhem_codemirror.js @@ -16,6 +16,7 @@ var cm_attr = { indentWithTabs: true, autofocus: true, lineNumbers: true, + keyMap: false, jumpToLine: false, jumpToLine_extraKey: false, smartIndent: false, @@ -103,6 +104,9 @@ function AddCodeMirror(e, cb) { cm_attr.extraKeys[cm_attr.jumpToLine_extraKey] = 'jumpToLine'; } } + if (cm_attr.keyMap) { + cm_active++; loadScript("codemirror/"+cm_attr.keyMap+".js", function(){cm_loaded++;} ); + } // editor user preferences if (cm_attr.height) { diff --git a/fhem/www/codemirror/vim.js b/fhem/www/codemirror/vim.js new file mode 100644 index 000000000..d3f4b6adb --- /dev/null +++ b/fhem/www/codemirror/vim.js @@ -0,0 +1,139 @@ +(function(q){"object"==typeof exports&&"object"==typeof module?q(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"],q):q(CodeMirror)})(function(q){var D=[{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:"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:"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:"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:"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:"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:"moveToEol",motionArgs:{inclusive:!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:"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:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},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:"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}},{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:"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"}],wa=[{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:"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:"global",shortName:"g"}],m=q.Pos;q.Vim= +function(){function ka(a,b){this==q.keyMap.vim&&q.rmClass(a.getWrapperElement(),"cm-fat-cursor");b&&b.attach==S||(a.setOption("disableInput",!1),a.off("cursorActivity",xa),q.off(a.getInputField(),"paste",ya(a)),a.state.vim=null)}function S(a,b){this==q.keyMap.vim&&q.addClass(a.getWrapperElement(),"cm-fat-cursor");b&&b.attach==S||(a.setOption("disableInput",!0),a.setOption("showCursorWhenSelecting",!1),q.signal(a,"vim-mode-change",{mode:"normal"}),a.on("cursorActivity",xa),aa(a),q.on(a.getInputField(), +"paste",ya(a)))}function la(a,b){if(b){var c=fb(a);if(!c)return!1;var d=q.Vim.findKey(b,c);"function"==typeof d&&q.signal(b,"vim-keypress",c);return d}}function fb(a){if("'"==a.charAt(0))return a.charAt(1);a=a.split(/-(?!$)/);var b=a[a.length-1];if(1==a.length&&1==a[0].length||2==a.length&&"Shift"==a[0]&&1==b.length)return!1;for(var c=!1,d=0;d"}function ya(a){var b= +a.state.vim;b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(y(a.getCursor(),0,1)),ba.enterInsertMode(a,{},b))});return b.onPasteFn}function ma(a,b){for(var c=[],d=a;d=a.firstLine()&&b<=a.lastLine()}function T(a){return/^[A-Z]$/.test(a)}function na(a,b){for(var c=0;cg?h:0;g=d[n].anchor;var q=Math.min(g.line,f.line),h=Math.max(g.line,f.line),l=g.ch,f=f.ch,d=d[n].head.ch-l,n=f-l;0=n?(l++,e||f--):0>d&&0<=n?(l--,k||f++):0>d&&-1==n&&(l--,f++);for(e=q;e<=h;e++)d={anchor:new m(e,l),head:new m(e,f)},c.push(d);a.setSelections(c);b.ch=f;g.ch=l;return g}function Ka(a,b,c){for(var d=[],f=0;fb&&(f.line=b),f.ch=B(a,f.line)),{ranges:[{anchor:e,head:f}],primary:0};if("block"==c){b=Math.min(e.line,f.line);a=Math.min(e.ch,f.ch);c=Math.max(e.ch,f.ch)+1;e=Math.max(e.line,f.line)-b+1;f=f.line==b?0:e-1;d=[];for(var g=0;g=a.length)return null;d?f=sa[0]:(f=ga[0],f(a.charAt(e))||(f=ga[1]));for(d=e;f(a.charAt(d))&&dk&&!d?d=!0:f=!1;for(h=b;h>g&&(f&&!a.getLine(h)!=d&&h!=b||!e(h,-1,!0));h--);return{start:new m(h,0),end:c}}function Pa(){}function L(a){a=a.state.vim;return a.searchState_||(a.searchState_=new Pa)}function Qa(a){var b=Ra(a)||[];if(!b.length)return[];var c=[];if(0===b[0]){for(var d=0;d'+b+"",{bottom:!0,duration:5E3}):alert(b)}function ha(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=b.desc,f=''+(b.prefix||"")+'';d&&(f+=' '+d+"");d=b.onClose;a.openDialog?a.openDialog(f, +d,{bottom:!0,value:b.value,onKeyDown:b.onKeyDown,onKeyUp:b.onKeyUp,selectValueOnOpen:!1}):d(prompt(c,""))}function W(a,b,c,d){if(b){var f=L(a),e;c=!!c;d=!!d;r.registerController.getRegister("/").setText(b);if(b instanceof RegExp)e=b;else{var g=Ra(b),k;g.length?(k=b.substring(0,g[0]),e=-1!=b.substring(g[0]).indexOf("i")):k=b;if(k){if(!U("pcre")){b=k;g=!1;k=[];for(var h=-1;h=b&&a<=c:a==b}function va(a){var b=a.getScrollInfo(),c=a.coordsChar({left:0,top:6+b.top},"local");a=a.coordsChar({left:0,top:b.clientHeight-10+b.top},"local");return{top:c.line,bottom:a.line}}function nb(a,b,c,d,f,e,g,k,h){function l(){a.operation(function(){for(;!v;)n(),m();p()})}function n(){var b=a.getRange(e.from(),e.to()).replace(g,k);e.replace(b)}function m(){for(;e.findNext()&&mb(e.from(),d,f);)if(c||!R||e.from().line!=R.line){a.scrollIntoView(e.from(),30);a.setSelection(e.from(), +e.to());R=e.from();v=!1;return}v=!0}function p(b){b&&b();a.focus();R&&(a.setCursor(R),b=a.state.vim,b.exMode=!1,b.lastHPos=b.lastHSPos=R.ch);h&&h()}function r(b,c,d){q.e_stop(b);switch(q.keyName(b)){case "Y":n();m();break;case "N":m();break;case "A":b=h;h=void 0;a.operation(l);h=b;break;case "L":n();case "Q":case "Esc":case "Ctrl-C":case "Ctrl-[":p(d)}v&&p(d);return!0}a.state.vim.exMode=!0;var v=!1,R=e.from();m();v?u(a,"No matches for "+g.source):b?ha(a,{prefix:"replace with "+k+" (y/n/a/q/l)", +onKeyDown:r}):(l(),h&&h())}function X(a){var b=a.state.vim,c=r.macroModeState,d=r.registerController.getRegister("."),f=c.isPlaying,e=c.lastInsertModeChanges,g;if(!f){var k=e.inVisualBlock?b.lastSelection.visualBlock.height:1,h=e.changes;g=[];for(var l=0;l",P(d,c))}else b.insertMode||(b.lastHPos=a.getCursor().ch)}b.visualMode&&Ma(a)}function Ma(a){var b=a.state.vim,c=A(a,x(b.sel.head)),d=y(c,0,1);b.fakeCursor&&b.fakeCursor.clear();b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function ia(a){this.keyName=a}function Va(a){function b(){c.changes.push(new ia(d)); +return!0}var c=r.macroModeState.lastInsertModeChanges,d=q.keyName(a);d&&(-1==d.indexOf("Delete")&&-1==d.indexOf("Backspace")||q.lookupKey(d,"vim-insert",b))}function Wa(a,b,c,d){function f(){k?N.processAction(a,b,b.lastEditActionCommand):N.evalInput(a,b)}function e(c){0"]),$a=[].concat(ja,Y,Za,["-",'"',".",":","/"]),J={};ca("filetype",void 0,"string",["ft"],function(a,b){if(void 0!==b){if(void 0===a){var c=b.getOption("mode");return"null"==c?"":c}b.setOption("mode",""==a?"null":a)}});var gb=function(){var a=-1,b=0,c=0,d=Array(100);return{cachedCursor:void 0,add:function(f,e,g){function k(b){var c=++a%100,e=d[c];e&&e.clear();d[c]=f.setBookmark(b)}var h=d[a%100]; +h?(h=h.find())&&!F(h,e)&&k(e):k(e);k(g);b=a;c=a-100+1;0>c&&(c=0)},move:function(f,e){a+=e;a>b?a=b:ac)}return g}}},Da=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};Ca.prototype={exitMacroRecordMode:function(){var a=r.macroModeState;if(a.onRecordingDone)a.onRecordingDone(); +a.onRecordingDone=void 0;a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=r.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var r,Z,ja={buildKeyMap:function(){},getRegisterController:function(){return r.registerController},resetVimGlobalState_:Ea,getVimGlobalState_:function(){return r},maybeInitVimState_:aa,suppressErrorLogging:!1,InsertModeKey:ia,map:function(a, +b,c){I.map(a,b,c)},unmap:function(a,b){I.unmap(a,b)},setOption:oa,getOption:U,defineOption:ca,defineEx:function(a,b,c){if(!b)b=a;else if(0!==a.indexOf(b))throw Error('(Vim.defineEx) "'+b+'" is not a prefix of "'+a+'", command not registered');ab[a]=c;I.commandMap_[b]={name:a,shortName:b,type:"api"}},handleKey:function(a,b,c){a=this.findKey(a,b,c);if("function"===typeof a)return a()},findKey:function(a,b,c){function d(){if(""==b)return z(a),g.visualMode?G(a):g.insertMode&&X(a),!0}function f(){if(d())return!0; +for(var c=g.inputState.keyBuffer+=b,e=1==b.length,f=N.matchCommand(c,D,g.inputState,"insert");1|<\w+>|./.exec(c),b=d[0],c=c.substring(d.index+b.length),q.Vim.handleKey(a,b,"mapping");else N.processCommand(a,g,k)}catch(e){throw a.state.vim=void 0, +aa(a),q.Vim.suppressErrorLogging||console.log(e),e;}return!0})}},handleEx:function(a,b){I.processCommand(a,b)},defineMotion:function(a,b){O[a]=b},defineAction:function(a,b){ba[a]=b},defineOperator:function(a,b){bb[a]=b},mapCommand:function(a,b,c,d,f){a={keys:a,type:b};a[b]=c;a[b+"Args"]=d;for(var e in f)a[e]=f[e];Xa(a)},_mapCommand:Xa,defineRegister:function(a,b){var c=r.registerController.registers[a];if(!a||1!=a.length)throw Error("Register name must be 1 character");if(c[a])throw Error("Register already defined "+ +a);c[a]=b;$a.push(a)},exitVisualMode:G,exitInsertMode:X};da.prototype.pushRepeatDigit=function(a){this.operator?this.motionRepeat=this.motionRepeat.concat(a):this.prefixRepeat=this.prefixRepeat.concat(a)};da.prototype.getRepeat=function(){var a=0;if(0=c.length)return this.iterator=c.length,this.initialPrefix;if(0>f)return a},pushInput:function(a){var b=this.historyBuffer.indexOf(a);-1"==n.slice(-11)){l=n.length-11;var m=e.slice(0,l),n=n.slice(0,l);e=m==n&&e.length>l?"full":0==n.indexOf(m)?"partial":!1}else e=e==n?"full":0==n.indexOf(e)?"partial":!1;l=e}l&&("partial"==e&&g.push(h),"full"==e&&f.push(h))}b=g.length&&g;f=f.length&&f;if(!f&&!b)return{type:"none"};if(!f&&b)return{type:"partial"};var p;for(b=0;b"==p.keys.slice(-11)){a=(f=/^.*(<[\w\-]+>)$/.exec(a))?f[1]:a.slice(-1);if(1":a= +"\n";break;case "":a=" "}c.selectedCharacter=a}return{type:"full",command:p}},processCommand:function(a,b,c){b.inputState.repeatOverride=c.repeatOverride;switch(c.type){case "motion":this.processMotion(a,b,c);break;case "operator":this.processOperator(a,b,c);break;case "operatorMotion":this.processOperatorMotion(a,b,c);break;case "action":this.processAction(a,b,c);break;case "search":this.processSearch(a,b,c);break;case "ex":case "keyToEx":this.processEx(a,b,c)}},processMotion:function(a,b, +c){b.inputState.motion=c.motion;b.inputState.motionArgs=ea(c.motionArgs);this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator){d.motion="expandToLine";d.motionArgs={linewise:!0};this.evalInput(a,b);return}z(a)}d.operator=c.operator;d.operatorArgs=ea(c.operatorArgs);b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,f=ea(c.operatorMotionArgs);f&&d&&f.visualLine&&(b.visualLine=!0);this.processOperator(a, +b,c);d||this.processMotion(a,b,c)},processAction:function(a,b,c){var d=b.inputState,f=d.getRepeat(),e=!!f,g=ea(c.actionArgs)||{};d.selectedCharacter&&(g.selectedCharacter=d.selectedCharacter);c.operator&&this.processOperator(a,b,c);c.motion&&this.processMotion(a,b,c);(c.motion||c.operator)&&this.evalInput(a,b);g.repeat=f||1;g.repeatIsExplicit=e;g.registerName=d.registerName;z(a);b.lastMotion=null;c.isEdit&&this.recordLastEdit(b,d,c);ba[c.action](a,g,b)},processSearch:function(a,b,c){function d(d, +e,f){r.searchHistoryController.pushInput(d);r.searchHistoryController.reset();try{W(a,d,e,f)}catch(g){u(a,"Invalid regex: "+d);z(a);return}N.processMotion(a,b,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:c.searchArgs.toJumplist}})}function f(b){a.scrollTo(m.left,m.top);d(b,!0,!0);var c=r.macroModeState;c.isRecording&&(c.isPlaying||(c=r.registerController.getRegister(c.latestRegister))&&c.pushSearchQuery&&c.pushSearchQuery(b))}function e(b,c,d){b=q.keyName(b);"Up"==b||"Down"== +b?(c=r.searchHistoryController.nextMatch(c,"Up"==b?!0:!1)||"",d(c)):"Left"!=b&&"Right"!=b&&"Ctrl"!=b&&"Alt"!=b&&"Shift"!=b&&r.searchHistoryController.reset();var e;try{e=W(a,c,!0,!0)}catch(f){}e?a.scrollIntoView(Ta(a,!k,e),30):(ua(a),a.scrollTo(m.left,m.top))}function g(b,c,d){var e=q.keyName(b);"Esc"==e||"Ctrl-C"==e||"Ctrl-["==e||"Backspace"==e&&""==c?(r.searchHistoryController.pushInput(c),r.searchHistoryController.reset(),W(a,n),ua(a),a.scrollTo(m.left,m.top),q.e_stop(b),z(a),d(),a.focus()):"Ctrl-U"== +e&&(q.e_stop(b),d(""))}if(a.getSearchCursor){var k=c.searchArgs.forward,h=c.searchArgs.wholeWordOnly;L(a).setReversed(!k);var l=k?"/":"?",n=L(a).getQuery(),m=a.getScrollInfo();switch(c.searchArgs.querySrc){case "prompt":h=r.macroModeState;h.isPlaying?(l=h.replaySearchQueries.shift(),d(l,!0,!1)):ha(a,{onClose:f,prefix:l,desc:pb,onKeyUp:e,onKeyDown:g});break;case "wordUnderCursor":var p=fa(a,!1,!0,!1,!0),t=!0;p||(p=fa(a,!1,!0,!1,!1),t=!1);p&&(l=a.getLine(p.start.line).substring(p.start.ch,p.end.ch), +l=t&&h?"\\b"+l+"\\b":l.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),r.jumpList.cachedCursor=a.getCursor(),a.setCursor(p.start),d(l,!0,!1))}}},processEx:function(a,b,c){function d(b){r.exCommandHistoryController.pushInput(b);r.exCommandHistoryController.reset();I.processCommand(a,b)}function f(b,c,d){var f=q.keyName(b);if("Esc"==f||"Ctrl-C"==f||"Ctrl-["==f||"Backspace"==f&&""==c)r.exCommandHistoryController.pushInput(c),r.exCommandHistoryController.reset(),q.e_stop(b),z(a),d(),a.focus();"Up"==f||"Down"== +f?(c=r.exCommandHistoryController.nextMatch(c,"Up"==f?!0:!1)||"",d(c)):"Ctrl-U"==f?(q.e_stop(b),d("")):"Left"!=f&&"Right"!=f&&"Ctrl"!=f&&"Alt"!=f&&"Shift"!=f&&r.exCommandHistoryController.reset()}"keyToEx"==c.type?I.processCommand(a,c.exArgs.input):b.visualMode?ha(a,{onClose:d,prefix:":",value:"'<,'>",onKeyDown:f}):ha(a,{onClose:d,prefix:":",onKeyDown:f})},evalInput:function(a,b){var c=b.inputState,d=c.motion,f=c.motionArgs||{},e=c.operator,g=c.operatorArgs||{},k=c.registerName,h=b.sel,l=x(b.visualMode? +A(a,h.head):a.getCursor("head")),n=x(b.visualMode?A(a,h.anchor):a.getCursor("anchor")),q=x(l),n=x(n),p,t,v;e&&this.recordLastEdit(b,c);v=void 0!==c.repeatOverride?c.repeatOverride:c.getRepeat();if(0",w(t,p)?p:t)):e||(p=A(a,p),a.setCursor(p.line,p.ch))}if(e){g.lastSel?(t=n,h=g.lastSel,p=Math.abs(h.head.line-h.anchor.line),l=Math.abs(h.head.ch-h.anchor.ch),p=h.visualLine?m(n.line+p,n.ch):h.visualBlock?m(n.line+p,n.ch+ +l):h.head.line==h.anchor.line?m(n.line,n.ch+l):m(n.line+p,n.ch),b.visualMode=!0,b.visualLine=h.visualLine,b.visualBlock=h.visualBlock,h=b.sel={anchor:t,head:p},V(a)):b.visualMode&&(g.lastSel={anchor:x(h.anchor),head:x(h.head),visualBlock:b.visualBlock,visualLine:b.visualLine});if(b.visualMode){if(t=C(h.head,h.anchor),h=P(h.head,h.anchor),q=b.visualLine||g.linewise,f=b.visualBlock?"block":q?"line":"char",t=ra(a,{anchor:t,head:h},f),q)if(h=t.ranges,"block"==f)for(f=0;fk&&b.line==k)return this.moveToEol(a,b,c,d);c.toFirstChar&&(f=H(a.getLine(e)),d.lastHPos=f);d.lastHSPos=a.charCoords(m(e,f),"div").left;return m(e,f)},moveByDisplayLines:function(a, +b,c,d){switch(d.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:d.lastHSPos=a.charCoords(b,"div").left}var f=c.repeat;b=a.findPosV(b,c.forward?f:-f,"line",d.lastHSPos);b.hitSide&&(c.forward?c={top:a.charCoords(b,"div").top+8,left:d.lastHSPos}:(c=a.charCoords(m(a.firstLine(),0),"div"),c.left=d.lastHSPos),b=a.coordsChar(c,"div"));d.lastHPos=b.ch;return b},moveByPage:function(a,b,c){var d=c.repeat;return a.findPosV(b, +c.forward?d:-d,"page")},moveByParagraph:function(a,b,c){return Oa(a,b,c.repeat,c.forward?1:-1)},moveByScroll:function(a,b,c,d){var f=a.getScrollInfo(),e=c.repeat;e||(e=f.clientHeight/(2*a.defaultTextHeight()));var g=a.charCoords(b,"local");c.repeat=e;b=O.moveByDisplayLines(a,b,c,d);if(!b)return null;c=a.charCoords(b,"local");a.scrollTo(null,f.top+c.top-g.top);return b},moveByWords:function(a,b,c){var d=b,f=c.repeat;b=!!c.forward;var e=!!c.wordEnd,g=!!c.bigWord;c=x(d);var k=[];(b&&!e||!b&&e)&&f++; +for(var h=!(b&&e),l=0;lh.ch||k.line>h.line)b=k,k=h,h=b;g?h.ch+=1:k.ch+=1;b={start:k,end:h}}else b={start:b,end:b}}else if(f[e]){c=e;b=x(b);d=a.getLine(b.line).split("");e=d.indexOf(c);b.cha.lastLine()&&b.linewise&&!k?a.replaceRange("",e,g):a.replaceRange("",d,g);b.linewise&&(k||(a.setCursor(e),q.commands.newlineAndIndent(a)),d.ch= +Number.MAX_VALUE)}r.registerController.pushText(b.registerName,"change",f,b.linewise,1e.top?(d.line+=(f-e.top)/c,d.line=Math.ceil(d.line), +a.setCursor(d),e=a.charCoords(d,"local"),a.scrollTo(null,e.top)):a.scrollTo(null,f):(b=f+a.getScrollInfo().clientHeight,b|<\w+>|./.exec(p),v=t[0],p=p.substring(t.index+v.length),q.Vim.handleKey(e,v,"macro"), +g.insertMode&&(t=l.insertModeChanges[m++].changes,r.macroModeState.lastInsertModeChanges.changes=t,Ya(e,t,1),X(e))}k.isPlaying=!1}},enterMacroRecordMode:function(a,b){r.macroModeState.enterMacroRecordMode(a,b.selectedCharacter)},enterInsertMode:function(a,b,c){if(!a.getOption("readOnly")){c.insertMode=!0;c.insertModeRepeat=b&&b.repeat||1;var d=b?b.insertAt:null,f=c.sel,e=b.head||a.getCursor("head"),g=a.listSelections().length;if("eol"==d)e=m(e.line,B(a,e.line));else if("charAfter"==d)e=y(e,0,1);else if("firstNonBlank"== +d)e=O.moveToFirstNonWhiteSpaceCharacter(a,e);else if("startOfSelectedArea"==d)c.visualBlock?(e=m(Math.min(f.head.line,f.anchor.line),Math.min(f.head.ch,f.anchor.ch)),g=Math.abs(f.head.line-f.anchor.line)+1):e=f.head.line=f.anchor.line?y(f.head,0,1):m(f.anchor.line,0);else if("inplace"== +d&&c.visualMode)return;a.setOption("keyMap","vim-insert");a.setOption("disableInput",!1);b&&b.replace?(a.toggleOverwrite(!0),a.setOption("keyMap","vim-replace"),q.signal(a,"vim-mode-change",{mode:"replace"})):(a.setOption("keyMap","vim-insert"),q.signal(a,"vim-mode-change",{mode:"insert"}));r.macroModeState.isPlaying||(a.on("change",Ua),q.on(a.getInputField(),"keydown",Va));c.visualMode&&G(a);Ka(a,e,g)}},toggleVisualMode:function(a,b,c){var d=b.repeat,f=a.getCursor();c.visualMode?c.visualLine^b.linewise|| +c.visualBlock^b.blockwise?(c.visualLine=!!b.linewise,c.visualBlock=!!b.blockwise,q.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}),V(a)):G(a):(c.visualMode=!0,c.visualLine=!!b.linewise,c.visualBlock=!!b.blockwise,b=A(a,m(f.line,f.ch+d-1),!0),c.sel={anchor:f,head:b},q.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}),V(a),K(a,c,"<",C(f,b)),K(a,c,">",P(f,b)))},reselectLastSelection:function(a, +b,c){b=c.lastSelection;c.visualMode&&La(a,c);if(b){var d=b.anchorMark.find(),f=b.headMark.find();d&&f&&(c.sel={anchor:d,head:f},c.visualMode=!0,c.visualLine=b.visualLine,c.visualBlock=b.visualBlock,V(a),K(a,c,"<",C(d,f)),K(a,c,">",P(d,f)),q.signal(a,"vim-mode-change",{mode:"visual",subMode:c.visualLine?"linewise":c.visualBlock?"blockwise":""}))}},joinLines:function(a,b,c){var d;if(c.visualMode){b=a.getCursor("anchor");d=a.getCursor("head");if(w(d,b)){var f=d;d=b;b=f}d.ch=B(a,d.line)-1}else d=Math.max(b.repeat, +2),b=a.getCursor(),d=A(a,m(b.line+d-1,Infinity));for(var e=0,g=b.line;gb?"":a.getOption("indentWithTabs")?Array(Math.floor(b/g)+1).join("\t"):Array(b+1).join(" ")}),e=e+(n?"\n":"");1a.lastLine()&&a.replaceRange("\n",m(p,0)),B(a,p)e.length&&(b=e.length),e=m(f.line,b));"\n"==d?(c.visualMode||a.replaceRange("", +f,e),(q.commands.newlineAndIndentContinueComment||q.commands.newlineAndIndent)(a)):(b=a.getRange(f,e),b=b.replace(/[^\n]/g,d),c.visualBlock?(f=Array(a.getOption("tabSize")+1).join(" "),b=a.getSelection(),b=b.replace(/\t/g,f).replace(/[^\n]/g,d).split("\n"),a.replaceSelections(b)):a.replaceRange(b,f,e),c.visualMode?(f=w(g[0].anchor,g[0].head)?g[0].anchor:g[0].head,a.setCursor(f),G(a,!1)):a.setCursor(y(e,0,-1)))},incrementNumberToken:function(a,b){for(var c=a.getCursor(),d=a.getLine(c.line),f=/-?\d+/g, +e,g,k,h;null!==(e=f.exec(d))&&!(h=e[0],g=e.index,k=g+h.length,c.chb.args.length?u(a,a.getOption("theme")):a.setOption("theme",b.args[0])},map:function(a,b,c){var d=b.args;!d||2>d.length?a&&u(a,"Invalid mapping: "+b.input):I.map(d[0],d[1],c)},imap:function(a,b){this.map(a,b,"insert")},nmap:function(a,b){this.map(a,b,"normal")},vmap:function(a,b){this.map(a,b,"visual")},unmap:function(a,b,c){var d=b.args;!d||1>d.length?a&&u(a,"No such mapping: "+b.input):I.unmap(d[0],c)},move:function(a, +b){N.processCommand(a,a.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:b.line+1})},set:function(a,b){var c=b.args,d=b.setCfg||{};if(!c||1>c.length)a&&u(a,"Invalid mapping: "+b.input);else{var f=c[0].split("="),c=f[0],f=f[1],e=!1;if("?"==c.charAt(c.length-1)){if(f)throw Error("Trailing characters: "+b.argString);c=c.substring(0,c.length-1);e=!0}void 0===f&&"no"==c.substring(0,2)&&(c=c.substring(2),f=!1);var g=J[c]&& +"boolean"==J[c].type;g&&void 0==f&&(f=!0);!g&&void 0===f||e?(d=U(c,a,d),!0===d||!1===d?u(a," "+(d?"":"no")+c):u(a," "+c+"="+d)):oa(c,f,a,d)}},setlocal:function(a,b){b.setCfg={scope:"local"};this.set(a,b)},setglobal:function(a,b){b.setCfg={scope:"global"};this.set(a,b)},registers:function(a,b){var c=b.args,d=r.registerController.registers,f="----------Registers----------

";if(c)for(var c=c.join(""),e=0;e")}else for(var k in d)c=d[k].toString(),c.length&&(f+='"'+k+" "+c+"
");u(a,f)},sort:function(a,b){function c(a,b){if(d){var c;c=a;a=b;b=c}f&&(a=a.toLowerCase(),b=b.toLowerCase());c=g&&n.exec(a);var e=g&&n.exec(b);if(!c)return a");if(g){var h=0,l=function(){h=g){u(a,"Invalid argument: "+b.argString.substring(f));break}for(f=0;f<=g-e;f++){var k=String.fromCharCode(e+ +f);delete c.marks[k]}}else{u(a,"Invalid argument: "+e+"-");break}}else delete c.marks[e]}else u(a,"Argument required")}},I=new Y;q.keyMap.vim={attach:S,detach:ka,call:la};ca("insertModeEscKeysTimeout",200,"number");q.keyMap["vim-insert"]={"Ctrl-N":"autocomplete","Ctrl-P":"autocomplete",Enter:function(a){(q.commands.newlineAndIndentContinueComment||q.commands.newlineAndIndent)(a)},fallthrough:["default"],attach:S,detach:ka,call:la};q.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"], +attach:S,detach:ka,call:la};Ea();return ja}()}); \ No newline at end of file