LaravelTest
720 строк · 26.1 Кб
1// CodeMirror, copyright (c) by Marijn Haverbeke and others
2// Distributed under an MIT license: https://codemirror.net/LICENSE
3
4// A rough approximation of Sublime Text's keybindings
5// Depends on addon/search/searchcursor.js and optionally addon/dialog/dialogs.js
6
7(function(mod) {8if (typeof exports == "object" && typeof module == "object") // CommonJS9mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/edit/matchbrackets"));10else if (typeof define == "function" && define.amd) // AMD11define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/edit/matchbrackets"], mod);12else // Plain browser env13mod(CodeMirror);14})(function(CodeMirror) {15"use strict";16
17var cmds = CodeMirror.commands;18var Pos = CodeMirror.Pos;19
20// This is not exactly Sublime's algorithm. I couldn't make heads or tails of that.21function findPosSubword(doc, start, dir) {22if (dir < 0 && start.ch == 0) return doc.clipPos(Pos(start.line - 1));23var line = doc.getLine(start.line);24if (dir > 0 && start.ch >= line.length) return doc.clipPos(Pos(start.line + 1, 0));25var state = "start", type, startPos = start.ch;26for (var pos = startPos, e = dir < 0 ? 0 : line.length, i = 0; pos != e; pos += dir, i++) {27var next = line.charAt(dir < 0 ? pos - 1 : pos);28var cat = next != "_" && CodeMirror.isWordChar(next) ? "w" : "o";29if (cat == "w" && next.toUpperCase() == next) cat = "W";30if (state == "start") {31if (cat != "o") { state = "in"; type = cat; }32else startPos = pos + dir33} else if (state == "in") {34if (type != cat) {35if (type == "w" && cat == "W" && dir < 0) pos--;36if (type == "W" && cat == "w" && dir > 0) { // From uppercase to lowercase37if (pos == startPos + 1) { type = "w"; continue; }38else pos--;39}40break;41}42}43}44return Pos(start.line, pos);45}46
47function moveSubword(cm, dir) {48cm.extendSelectionsBy(function(range) {49if (cm.display.shift || cm.doc.extend || range.empty())50return findPosSubword(cm.doc, range.head, dir);51else52return dir < 0 ? range.from() : range.to();53});54}55
56cmds.goSubwordLeft = function(cm) { moveSubword(cm, -1); };57cmds.goSubwordRight = function(cm) { moveSubword(cm, 1); };58
59cmds.scrollLineUp = function(cm) {60var info = cm.getScrollInfo();61if (!cm.somethingSelected()) {62var visibleBottomLine = cm.lineAtHeight(info.top + info.clientHeight, "local");63if (cm.getCursor().line >= visibleBottomLine)64cm.execCommand("goLineUp");65}66cm.scrollTo(null, info.top - cm.defaultTextHeight());67};68cmds.scrollLineDown = function(cm) {69var info = cm.getScrollInfo();70if (!cm.somethingSelected()) {71var visibleTopLine = cm.lineAtHeight(info.top, "local")+1;72if (cm.getCursor().line <= visibleTopLine)73cm.execCommand("goLineDown");74}75cm.scrollTo(null, info.top + cm.defaultTextHeight());76};77
78cmds.splitSelectionByLine = function(cm) {79var ranges = cm.listSelections(), lineRanges = [];80for (var i = 0; i < ranges.length; i++) {81var from = ranges[i].from(), to = ranges[i].to();82for (var line = from.line; line <= to.line; ++line)83if (!(to.line > from.line && line == to.line && to.ch == 0))84lineRanges.push({anchor: line == from.line ? from : Pos(line, 0),85head: line == to.line ? to : Pos(line)});86}87cm.setSelections(lineRanges, 0);88};89
90cmds.singleSelectionTop = function(cm) {91var range = cm.listSelections()[0];92cm.setSelection(range.anchor, range.head, {scroll: false});93};94
95cmds.selectLine = function(cm) {96var ranges = cm.listSelections(), extended = [];97for (var i = 0; i < ranges.length; i++) {98var range = ranges[i];99extended.push({anchor: Pos(range.from().line, 0),100head: Pos(range.to().line + 1, 0)});101}102cm.setSelections(extended);103};104
105function insertLine(cm, above) {106if (cm.isReadOnly()) return CodeMirror.Pass107cm.operation(function() {108var len = cm.listSelections().length, newSelection = [], last = -1;109for (var i = 0; i < len; i++) {110var head = cm.listSelections()[i].head;111if (head.line <= last) continue;112var at = Pos(head.line + (above ? 0 : 1), 0);113cm.replaceRange("\n", at, null, "+insertLine");114cm.indentLine(at.line, null, true);115newSelection.push({head: at, anchor: at});116last = head.line + 1;117}118cm.setSelections(newSelection);119});120cm.execCommand("indentAuto");121}122
123cmds.insertLineAfter = function(cm) { return insertLine(cm, false); };124
125cmds.insertLineBefore = function(cm) { return insertLine(cm, true); };126
127function wordAt(cm, pos) {128var start = pos.ch, end = start, line = cm.getLine(pos.line);129while (start && CodeMirror.isWordChar(line.charAt(start - 1))) --start;130while (end < line.length && CodeMirror.isWordChar(line.charAt(end))) ++end;131return {from: Pos(pos.line, start), to: Pos(pos.line, end), word: line.slice(start, end)};132}133
134cmds.selectNextOccurrence = function(cm) {135var from = cm.getCursor("from"), to = cm.getCursor("to");136var fullWord = cm.state.sublimeFindFullWord == cm.doc.sel;137if (CodeMirror.cmpPos(from, to) == 0) {138var word = wordAt(cm, from);139if (!word.word) return;140cm.setSelection(word.from, word.to);141fullWord = true;142} else {143var text = cm.getRange(from, to);144var query = fullWord ? new RegExp("\\b" + text + "\\b") : text;145var cur = cm.getSearchCursor(query, to);146var found = cur.findNext();147if (!found) {148cur = cm.getSearchCursor(query, Pos(cm.firstLine(), 0));149found = cur.findNext();150}151if (!found || isSelectedRange(cm.listSelections(), cur.from(), cur.to())) return152cm.addSelection(cur.from(), cur.to());153}154if (fullWord)155cm.state.sublimeFindFullWord = cm.doc.sel;156};157
158cmds.skipAndSelectNextOccurrence = function(cm) {159var prevAnchor = cm.getCursor("anchor"), prevHead = cm.getCursor("head");160cmds.selectNextOccurrence(cm);161if (CodeMirror.cmpPos(prevAnchor, prevHead) != 0) {162cm.doc.setSelections(cm.doc.listSelections()163.filter(function (sel) {164return sel.anchor != prevAnchor || sel.head != prevHead;165}));166}167}168
169function addCursorToSelection(cm, dir) {170var ranges = cm.listSelections(), newRanges = [];171for (var i = 0; i < ranges.length; i++) {172var range = ranges[i];173var newAnchor = cm.findPosV(174range.anchor, dir, "line", range.anchor.goalColumn);175var newHead = cm.findPosV(176range.head, dir, "line", range.head.goalColumn);177newAnchor.goalColumn = range.anchor.goalColumn != null ?178range.anchor.goalColumn : cm.cursorCoords(range.anchor, "div").left;179newHead.goalColumn = range.head.goalColumn != null ?180range.head.goalColumn : cm.cursorCoords(range.head, "div").left;181var newRange = {anchor: newAnchor, head: newHead};182newRanges.push(range);183newRanges.push(newRange);184}185cm.setSelections(newRanges);186}187cmds.addCursorToPrevLine = function(cm) { addCursorToSelection(cm, -1); };188cmds.addCursorToNextLine = function(cm) { addCursorToSelection(cm, 1); };189
190function isSelectedRange(ranges, from, to) {191for (var i = 0; i < ranges.length; i++)192if (CodeMirror.cmpPos(ranges[i].from(), from) == 0 &&193CodeMirror.cmpPos(ranges[i].to(), to) == 0) return true194return false195}196
197var mirror = "(){}[]";198function selectBetweenBrackets(cm) {199var ranges = cm.listSelections(), newRanges = []200for (var i = 0; i < ranges.length; i++) {201var range = ranges[i], pos = range.head, opening = cm.scanForBracket(pos, -1);202if (!opening) return false;203for (;;) {204var closing = cm.scanForBracket(pos, 1);205if (!closing) return false;206if (closing.ch == mirror.charAt(mirror.indexOf(opening.ch) + 1)) {207var startPos = Pos(opening.pos.line, opening.pos.ch + 1);208if (CodeMirror.cmpPos(startPos, range.from()) == 0 &&209CodeMirror.cmpPos(closing.pos, range.to()) == 0) {210opening = cm.scanForBracket(opening.pos, -1);211if (!opening) return false;212} else {213newRanges.push({anchor: startPos, head: closing.pos});214break;215}216}217pos = Pos(closing.pos.line, closing.pos.ch + 1);218}219}220cm.setSelections(newRanges);221return true;222}223
224cmds.selectScope = function(cm) {225selectBetweenBrackets(cm) || cm.execCommand("selectAll");226};227cmds.selectBetweenBrackets = function(cm) {228if (!selectBetweenBrackets(cm)) return CodeMirror.Pass;229};230
231function puncType(type) {232return !type ? null : /\bpunctuation\b/.test(type) ? type : undefined233}234
235cmds.goToBracket = function(cm) {236cm.extendSelectionsBy(function(range) {237var next = cm.scanForBracket(range.head, 1, puncType(cm.getTokenTypeAt(range.head)));238if (next && CodeMirror.cmpPos(next.pos, range.head) != 0) return next.pos;239var prev = cm.scanForBracket(range.head, -1, puncType(cm.getTokenTypeAt(Pos(range.head.line, range.head.ch + 1))));240return prev && Pos(prev.pos.line, prev.pos.ch + 1) || range.head;241});242};243
244cmds.swapLineUp = function(cm) {245if (cm.isReadOnly()) return CodeMirror.Pass246var ranges = cm.listSelections(), linesToMove = [], at = cm.firstLine() - 1, newSels = [];247for (var i = 0; i < ranges.length; i++) {248var range = ranges[i], from = range.from().line - 1, to = range.to().line;249newSels.push({anchor: Pos(range.anchor.line - 1, range.anchor.ch),250head: Pos(range.head.line - 1, range.head.ch)});251if (range.to().ch == 0 && !range.empty()) --to;252if (from > at) linesToMove.push(from, to);253else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;254at = to;255}256cm.operation(function() {257for (var i = 0; i < linesToMove.length; i += 2) {258var from = linesToMove[i], to = linesToMove[i + 1];259var line = cm.getLine(from);260cm.replaceRange("", Pos(from, 0), Pos(from + 1, 0), "+swapLine");261if (to > cm.lastLine())262cm.replaceRange("\n" + line, Pos(cm.lastLine()), null, "+swapLine");263else264cm.replaceRange(line + "\n", Pos(to, 0), null, "+swapLine");265}266cm.setSelections(newSels);267cm.scrollIntoView();268});269};270
271cmds.swapLineDown = function(cm) {272if (cm.isReadOnly()) return CodeMirror.Pass273var ranges = cm.listSelections(), linesToMove = [], at = cm.lastLine() + 1;274for (var i = ranges.length - 1; i >= 0; i--) {275var range = ranges[i], from = range.to().line + 1, to = range.from().line;276if (range.to().ch == 0 && !range.empty()) from--;277if (from < at) linesToMove.push(from, to);278else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;279at = to;280}281cm.operation(function() {282for (var i = linesToMove.length - 2; i >= 0; i -= 2) {283var from = linesToMove[i], to = linesToMove[i + 1];284var line = cm.getLine(from);285if (from == cm.lastLine())286cm.replaceRange("", Pos(from - 1), Pos(from), "+swapLine");287else288cm.replaceRange("", Pos(from, 0), Pos(from + 1, 0), "+swapLine");289cm.replaceRange(line + "\n", Pos(to, 0), null, "+swapLine");290}291cm.scrollIntoView();292});293};294
295cmds.toggleCommentIndented = function(cm) {296cm.toggleComment({ indent: true });297}298
299cmds.joinLines = function(cm) {300var ranges = cm.listSelections(), joined = [];301for (var i = 0; i < ranges.length; i++) {302var range = ranges[i], from = range.from();303var start = from.line, end = range.to().line;304while (i < ranges.length - 1 && ranges[i + 1].from().line == end)305end = ranges[++i].to().line;306joined.push({start: start, end: end, anchor: !range.empty() && from});307}308cm.operation(function() {309var offset = 0, ranges = [];310for (var i = 0; i < joined.length; i++) {311var obj = joined[i];312var anchor = obj.anchor && Pos(obj.anchor.line - offset, obj.anchor.ch), head;313for (var line = obj.start; line <= obj.end; line++) {314var actual = line - offset;315if (line == obj.end) head = Pos(actual, cm.getLine(actual).length + 1);316if (actual < cm.lastLine()) {317cm.replaceRange(" ", Pos(actual), Pos(actual + 1, /^\s*/.exec(cm.getLine(actual + 1))[0].length));318++offset;319}320}321ranges.push({anchor: anchor || head, head: head});322}323cm.setSelections(ranges, 0);324});325};326
327cmds.duplicateLine = function(cm) {328cm.operation(function() {329var rangeCount = cm.listSelections().length;330for (var i = 0; i < rangeCount; i++) {331var range = cm.listSelections()[i];332if (range.empty())333cm.replaceRange(cm.getLine(range.head.line) + "\n", Pos(range.head.line, 0));334else335cm.replaceRange(cm.getRange(range.from(), range.to()), range.from());336}337cm.scrollIntoView();338});339};340
341
342function sortLines(cm, caseSensitive, direction) {343if (cm.isReadOnly()) return CodeMirror.Pass344var ranges = cm.listSelections(), toSort = [], selected;345for (var i = 0; i < ranges.length; i++) {346var range = ranges[i];347if (range.empty()) continue;348var from = range.from().line, to = range.to().line;349while (i < ranges.length - 1 && ranges[i + 1].from().line == to)350to = ranges[++i].to().line;351if (!ranges[i].to().ch) to--;352toSort.push(from, to);353}354if (toSort.length) selected = true;355else toSort.push(cm.firstLine(), cm.lastLine());356
357cm.operation(function() {358var ranges = [];359for (var i = 0; i < toSort.length; i += 2) {360var from = toSort[i], to = toSort[i + 1];361var start = Pos(from, 0), end = Pos(to);362var lines = cm.getRange(start, end, false);363if (caseSensitive)364lines.sort(function(a, b) { return a < b ? -direction : a == b ? 0 : direction; });365else366lines.sort(function(a, b) {367var au = a.toUpperCase(), bu = b.toUpperCase();368if (au != bu) { a = au; b = bu; }369return a < b ? -direction : a == b ? 0 : direction;370});371cm.replaceRange(lines, start, end);372if (selected) ranges.push({anchor: start, head: Pos(to + 1, 0)});373}374if (selected) cm.setSelections(ranges, 0);375});376}377
378cmds.sortLines = function(cm) { sortLines(cm, true, 1); };379cmds.reverseSortLines = function(cm) { sortLines(cm, true, -1); };380cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false, 1); };381cmds.reverseSortLinesInsensitive = function(cm) { sortLines(cm, false, -1); };382
383cmds.nextBookmark = function(cm) {384var marks = cm.state.sublimeBookmarks;385if (marks) while (marks.length) {386var current = marks.shift();387var found = current.find();388if (found) {389marks.push(current);390return cm.setSelection(found.from, found.to);391}392}393};394
395cmds.prevBookmark = function(cm) {396var marks = cm.state.sublimeBookmarks;397if (marks) while (marks.length) {398marks.unshift(marks.pop());399var found = marks[marks.length - 1].find();400if (!found)401marks.pop();402else403return cm.setSelection(found.from, found.to);404}405};406
407cmds.toggleBookmark = function(cm) {408var ranges = cm.listSelections();409var marks = cm.state.sublimeBookmarks || (cm.state.sublimeBookmarks = []);410for (var i = 0; i < ranges.length; i++) {411var from = ranges[i].from(), to = ranges[i].to();412var found = ranges[i].empty() ? cm.findMarksAt(from) : cm.findMarks(from, to);413for (var j = 0; j < found.length; j++) {414if (found[j].sublimeBookmark) {415found[j].clear();416for (var k = 0; k < marks.length; k++)417if (marks[k] == found[j])418marks.splice(k--, 1);419break;420}421}422if (j == found.length)423marks.push(cm.markText(from, to, {sublimeBookmark: true, clearWhenEmpty: false}));424}425};426
427cmds.clearBookmarks = function(cm) {428var marks = cm.state.sublimeBookmarks;429if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();430marks.length = 0;431};432
433cmds.selectBookmarks = function(cm) {434var marks = cm.state.sublimeBookmarks, ranges = [];435if (marks) for (var i = 0; i < marks.length; i++) {436var found = marks[i].find();437if (!found)438marks.splice(i--, 0);439else440ranges.push({anchor: found.from, head: found.to});441}442if (ranges.length)443cm.setSelections(ranges, 0);444};445
446function modifyWordOrSelection(cm, mod) {447cm.operation(function() {448var ranges = cm.listSelections(), indices = [], replacements = [];449for (var i = 0; i < ranges.length; i++) {450var range = ranges[i];451if (range.empty()) { indices.push(i); replacements.push(""); }452else replacements.push(mod(cm.getRange(range.from(), range.to())));453}454cm.replaceSelections(replacements, "around", "case");455for (var i = indices.length - 1, at; i >= 0; i--) {456var range = ranges[indices[i]];457if (at && CodeMirror.cmpPos(range.head, at) > 0) continue;458var word = wordAt(cm, range.head);459at = word.from;460cm.replaceRange(mod(word.word), word.from, word.to);461}462});463}464
465cmds.smartBackspace = function(cm) {466if (cm.somethingSelected()) return CodeMirror.Pass;467
468cm.operation(function() {469var cursors = cm.listSelections();470var indentUnit = cm.getOption("indentUnit");471
472for (var i = cursors.length - 1; i >= 0; i--) {473var cursor = cursors[i].head;474var toStartOfLine = cm.getRange({line: cursor.line, ch: 0}, cursor);475var column = CodeMirror.countColumn(toStartOfLine, null, cm.getOption("tabSize"));476
477// Delete by one character by default478var deletePos = cm.findPosH(cursor, -1, "char", false);479
480if (toStartOfLine && !/\S/.test(toStartOfLine) && column % indentUnit == 0) {481var prevIndent = new Pos(cursor.line,482CodeMirror.findColumn(toStartOfLine, column - indentUnit, indentUnit));483
484// Smart delete only if we found a valid prevIndent location485if (prevIndent.ch != cursor.ch) deletePos = prevIndent;486}487
488cm.replaceRange("", deletePos, cursor, "+delete");489}490});491};492
493cmds.delLineRight = function(cm) {494cm.operation(function() {495var ranges = cm.listSelections();496for (var i = ranges.length - 1; i >= 0; i--)497cm.replaceRange("", ranges[i].anchor, Pos(ranges[i].to().line), "+delete");498cm.scrollIntoView();499});500};501
502cmds.upcaseAtCursor = function(cm) {503modifyWordOrSelection(cm, function(str) { return str.toUpperCase(); });504};505cmds.downcaseAtCursor = function(cm) {506modifyWordOrSelection(cm, function(str) { return str.toLowerCase(); });507};508
509cmds.setSublimeMark = function(cm) {510if (cm.state.sublimeMark) cm.state.sublimeMark.clear();511cm.state.sublimeMark = cm.setBookmark(cm.getCursor());512};513cmds.selectToSublimeMark = function(cm) {514var found = cm.state.sublimeMark && cm.state.sublimeMark.find();515if (found) cm.setSelection(cm.getCursor(), found);516};517cmds.deleteToSublimeMark = function(cm) {518var found = cm.state.sublimeMark && cm.state.sublimeMark.find();519if (found) {520var from = cm.getCursor(), to = found;521if (CodeMirror.cmpPos(from, to) > 0) { var tmp = to; to = from; from = tmp; }522cm.state.sublimeKilled = cm.getRange(from, to);523cm.replaceRange("", from, to);524}525};526cmds.swapWithSublimeMark = function(cm) {527var found = cm.state.sublimeMark && cm.state.sublimeMark.find();528if (found) {529cm.state.sublimeMark.clear();530cm.state.sublimeMark = cm.setBookmark(cm.getCursor());531cm.setCursor(found);532}533};534cmds.sublimeYank = function(cm) {535if (cm.state.sublimeKilled != null)536cm.replaceSelection(cm.state.sublimeKilled, null, "paste");537};538
539cmds.showInCenter = function(cm) {540var pos = cm.cursorCoords(null, "local");541cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2);542};543
544function getTarget(cm) {545var from = cm.getCursor("from"), to = cm.getCursor("to");546if (CodeMirror.cmpPos(from, to) == 0) {547var word = wordAt(cm, from);548if (!word.word) return;549from = word.from;550to = word.to;551}552return {from: from, to: to, query: cm.getRange(from, to), word: word};553}554
555function findAndGoTo(cm, forward) {556var target = getTarget(cm);557if (!target) return;558var query = target.query;559var cur = cm.getSearchCursor(query, forward ? target.to : target.from);560
561if (forward ? cur.findNext() : cur.findPrevious()) {562cm.setSelection(cur.from(), cur.to());563} else {564cur = cm.getSearchCursor(query, forward ? Pos(cm.firstLine(), 0)565: cm.clipPos(Pos(cm.lastLine())));566if (forward ? cur.findNext() : cur.findPrevious())567cm.setSelection(cur.from(), cur.to());568else if (target.word)569cm.setSelection(target.from, target.to);570}571};572cmds.findUnder = function(cm) { findAndGoTo(cm, true); };573cmds.findUnderPrevious = function(cm) { findAndGoTo(cm,false); };574cmds.findAllUnder = function(cm) {575var target = getTarget(cm);576if (!target) return;577var cur = cm.getSearchCursor(target.query);578var matches = [];579var primaryIndex = -1;580while (cur.findNext()) {581matches.push({anchor: cur.from(), head: cur.to()});582if (cur.from().line <= target.from.line && cur.from().ch <= target.from.ch)583primaryIndex++;584}585cm.setSelections(matches, primaryIndex);586};587
588
589var keyMap = CodeMirror.keyMap;590keyMap.macSublime = {591"Cmd-Left": "goLineStartSmart",592"Shift-Tab": "indentLess",593"Shift-Ctrl-K": "deleteLine",594"Alt-Q": "wrapLines",595"Ctrl-Left": "goSubwordLeft",596"Ctrl-Right": "goSubwordRight",597"Ctrl-Alt-Up": "scrollLineUp",598"Ctrl-Alt-Down": "scrollLineDown",599"Cmd-L": "selectLine",600"Shift-Cmd-L": "splitSelectionByLine",601"Esc": "singleSelectionTop",602"Cmd-Enter": "insertLineAfter",603"Shift-Cmd-Enter": "insertLineBefore",604"Cmd-D": "selectNextOccurrence",605"Shift-Cmd-Space": "selectScope",606"Shift-Cmd-M": "selectBetweenBrackets",607"Cmd-M": "goToBracket",608"Cmd-Ctrl-Up": "swapLineUp",609"Cmd-Ctrl-Down": "swapLineDown",610"Cmd-/": "toggleCommentIndented",611"Cmd-J": "joinLines",612"Shift-Cmd-D": "duplicateLine",613"F5": "sortLines",614"Shift-F5": "reverseSortLines",615"Cmd-F5": "sortLinesInsensitive",616"Shift-Cmd-F5": "reverseSortLinesInsensitive",617"F2": "nextBookmark",618"Shift-F2": "prevBookmark",619"Cmd-F2": "toggleBookmark",620"Shift-Cmd-F2": "clearBookmarks",621"Alt-F2": "selectBookmarks",622"Backspace": "smartBackspace",623"Cmd-K Cmd-D": "skipAndSelectNextOccurrence",624"Cmd-K Cmd-K": "delLineRight",625"Cmd-K Cmd-U": "upcaseAtCursor",626"Cmd-K Cmd-L": "downcaseAtCursor",627"Cmd-K Cmd-Space": "setSublimeMark",628"Cmd-K Cmd-A": "selectToSublimeMark",629"Cmd-K Cmd-W": "deleteToSublimeMark",630"Cmd-K Cmd-X": "swapWithSublimeMark",631"Cmd-K Cmd-Y": "sublimeYank",632"Cmd-K Cmd-C": "showInCenter",633"Cmd-K Cmd-G": "clearBookmarks",634"Cmd-K Cmd-Backspace": "delLineLeft",635"Cmd-K Cmd-1": "foldAll",636"Cmd-K Cmd-0": "unfoldAll",637"Cmd-K Cmd-J": "unfoldAll",638"Ctrl-Shift-Up": "addCursorToPrevLine",639"Ctrl-Shift-Down": "addCursorToNextLine",640"Cmd-F3": "findUnder",641"Shift-Cmd-F3": "findUnderPrevious",642"Alt-F3": "findAllUnder",643"Shift-Cmd-[": "fold",644"Shift-Cmd-]": "unfold",645"Cmd-I": "findIncremental",646"Shift-Cmd-I": "findIncrementalReverse",647"Cmd-H": "replace",648"F3": "findNext",649"Shift-F3": "findPrev",650"fallthrough": "macDefault"651};652CodeMirror.normalizeKeyMap(keyMap.macSublime);653
654keyMap.pcSublime = {655"Shift-Tab": "indentLess",656"Shift-Ctrl-K": "deleteLine",657"Alt-Q": "wrapLines",658"Ctrl-T": "transposeChars",659"Alt-Left": "goSubwordLeft",660"Alt-Right": "goSubwordRight",661"Ctrl-Up": "scrollLineUp",662"Ctrl-Down": "scrollLineDown",663"Ctrl-L": "selectLine",664"Shift-Ctrl-L": "splitSelectionByLine",665"Esc": "singleSelectionTop",666"Ctrl-Enter": "insertLineAfter",667"Shift-Ctrl-Enter": "insertLineBefore",668"Ctrl-D": "selectNextOccurrence",669"Shift-Ctrl-Space": "selectScope",670"Shift-Ctrl-M": "selectBetweenBrackets",671"Ctrl-M": "goToBracket",672"Shift-Ctrl-Up": "swapLineUp",673"Shift-Ctrl-Down": "swapLineDown",674"Ctrl-/": "toggleCommentIndented",675"Ctrl-J": "joinLines",676"Shift-Ctrl-D": "duplicateLine",677"F9": "sortLines",678"Shift-F9": "reverseSortLines",679"Ctrl-F9": "sortLinesInsensitive",680"Shift-Ctrl-F9": "reverseSortLinesInsensitive",681"F2": "nextBookmark",682"Shift-F2": "prevBookmark",683"Ctrl-F2": "toggleBookmark",684"Shift-Ctrl-F2": "clearBookmarks",685"Alt-F2": "selectBookmarks",686"Backspace": "smartBackspace",687"Ctrl-K Ctrl-D": "skipAndSelectNextOccurrence",688"Ctrl-K Ctrl-K": "delLineRight",689"Ctrl-K Ctrl-U": "upcaseAtCursor",690"Ctrl-K Ctrl-L": "downcaseAtCursor",691"Ctrl-K Ctrl-Space": "setSublimeMark",692"Ctrl-K Ctrl-A": "selectToSublimeMark",693"Ctrl-K Ctrl-W": "deleteToSublimeMark",694"Ctrl-K Ctrl-X": "swapWithSublimeMark",695"Ctrl-K Ctrl-Y": "sublimeYank",696"Ctrl-K Ctrl-C": "showInCenter",697"Ctrl-K Ctrl-G": "clearBookmarks",698"Ctrl-K Ctrl-Backspace": "delLineLeft",699"Ctrl-K Ctrl-1": "foldAll",700"Ctrl-K Ctrl-0": "unfoldAll",701"Ctrl-K Ctrl-J": "unfoldAll",702"Ctrl-Alt-Up": "addCursorToPrevLine",703"Ctrl-Alt-Down": "addCursorToNextLine",704"Ctrl-F3": "findUnder",705"Shift-Ctrl-F3": "findUnderPrevious",706"Alt-F3": "findAllUnder",707"Shift-Ctrl-[": "fold",708"Shift-Ctrl-]": "unfold",709"Ctrl-I": "findIncremental",710"Shift-Ctrl-I": "findIncrementalReverse",711"Ctrl-H": "replace",712"F3": "findNext",713"Shift-F3": "findPrev",714"fallthrough": "pcDefault"715};716CodeMirror.normalizeKeyMap(keyMap.pcSublime);717
718var mac = keyMap.default == keyMap.macDefault;719keyMap.sublime = mac ? keyMap.macSublime : keyMap.pcSublime;720});721