diff options
Diffstat (limited to 'imports')
59 files changed, 3859 insertions, 1244 deletions
diff --git a/imports/codemirror/LICENSE b/imports/codemirror/LICENSE index f62410e6..3916e96b 100644 --- a/imports/codemirror/LICENSE +++ b/imports/codemirror/LICENSE | |||
@@ -1,4 +1,4 @@ | |||
1 | Copyright (C) 2011 by Marijn Haverbeke <marijnh@gmail.com> | 1 | Copyright (C) 2012 by Marijn Haverbeke <marijnh@gmail.com> |
2 | 2 | ||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy |
4 | of this software and associated documentation files (the "Software"), to deal | 4 | of this software and associated documentation files (the "Software"), to deal |
diff --git a/imports/codemirror/keymap/emacs.js b/imports/codemirror/keymap/emacs.js index 8fd3564e..2a57e2ff 100644 --- a/imports/codemirror/keymap/emacs.js +++ b/imports/codemirror/keymap/emacs.js | |||
@@ -18,12 +18,12 @@ | |||
18 | "Alt-Y": function(cm) {cm.replaceSelection(popFromRing());}, | 18 | "Alt-Y": function(cm) {cm.replaceSelection(popFromRing());}, |
19 | "Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd", | 19 | "Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd", |
20 | "Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace", | 20 | "Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace", |
21 | "Ctrl-Z": "undo", "Cmd-Z": "undo", | 21 | "Ctrl-Z": "undo", "Cmd-Z": "undo", "Alt-/": "autocomplete", |
22 | fallthrough: ["basic", "emacsy"] | 22 | fallthrough: ["basic", "emacsy"] |
23 | }; | 23 | }; |
24 | 24 | ||
25 | CodeMirror.keyMap["emacs-Ctrl-X"] = { | 25 | CodeMirror.keyMap["emacs-Ctrl-X"] = { |
26 | "Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close", | 26 | "Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close", |
27 | auto: "emacs", catchall: function(cm) {/*ignore*/} | 27 | auto: "emacs", nofallthrough: true |
28 | }; | 28 | }; |
29 | })(); | 29 | })(); |
diff --git a/imports/codemirror/keymap/vim.js b/imports/codemirror/keymap/vim.js index f8fa5e07..2aa6e0f7 100644 --- a/imports/codemirror/keymap/vim.js +++ b/imports/codemirror/keymap/vim.js | |||
@@ -1,21 +1,96 @@ | |||
1 | // Supported keybindings: | ||
2 | // | ||
3 | // Cursor movement: | ||
4 | // h, j, k, l | ||
5 | // e, E, w, W, b, B | ||
6 | // Ctrl-f, Ctrl-b | ||
7 | // Ctrl-n, Ctrl-p | ||
8 | // $, ^, 0 | ||
9 | // G | ||
10 | // ge, gE | ||
11 | // gg | ||
12 | // f<char>, F<char>, t<char>, T<char> | ||
13 | // Ctrl-o, Ctrl-i TODO (FIXME - Ctrl-O wont work in Chrome) | ||
14 | // /, ?, n, N TODO (does not work) | ||
15 | // #, * TODO | ||
16 | // | ||
17 | // Entering insert mode: | ||
18 | // i, I, a, A, o, O | ||
19 | // s | ||
20 | // ce, cb (without support for number of actions like c3e - TODO) | ||
21 | // cc | ||
22 | // S, C TODO | ||
23 | // cf<char>, cF<char>, ct<char>, cT<char> | ||
24 | // | ||
25 | // Deleting text: | ||
26 | // x, X | ||
27 | // J | ||
28 | // dd, D | ||
29 | // de, db (without support for number of actions like d3e - TODO) | ||
30 | // df<char>, dF<char>, dt<char>, dT<char> | ||
31 | // | ||
32 | // Yanking and pasting: | ||
33 | // yy, Y | ||
34 | // p, P | ||
35 | // p'<char> TODO - test | ||
36 | // y'<char> TODO - test | ||
37 | // m<char> TODO - test | ||
38 | // | ||
39 | // Changing text in place: | ||
40 | // ~ | ||
41 | // r<char> | ||
42 | // | ||
43 | // Visual mode: | ||
44 | // v, V TODO | ||
45 | // | ||
46 | // Misc: | ||
47 | // . TODO | ||
48 | // | ||
49 | |||
1 | (function() { | 50 | (function() { |
2 | var count = ""; | 51 | var count = ""; |
3 | var sdir = "f"; | 52 | var sdir = "f"; |
4 | var buf = ""; | 53 | var buf = ""; |
5 | var yank = 0; | 54 | var yank = 0; |
6 | var mark = []; | 55 | var mark = []; |
56 | var reptTimes = 0; | ||
7 | function emptyBuffer() { buf = ""; } | 57 | function emptyBuffer() { buf = ""; } |
8 | function pushInBuffer(str) { buf += str; }; | 58 | function pushInBuffer(str) { buf += str; } |
9 | function pushCountDigit(digit) { return function(cm) {count += digit;} } | 59 | function pushCountDigit(digit) { return function(cm) {count += digit;}; } |
10 | function popCount() { var i = parseInt(count); count = ""; return i || 1; } | 60 | function popCount() { var i = parseInt(count, 10); count = ""; return i || 1; } |
61 | function iterTimes(func) { | ||
62 | for (var i = 0, c = popCount(); i < c; ++i) func(i, i == c - 1); | ||
63 | } | ||
11 | function countTimes(func) { | 64 | function countTimes(func) { |
12 | if (typeof func == "string") func = CodeMirror.commands[func]; | 65 | if (typeof func == "string") func = CodeMirror.commands[func]; |
13 | return function(cm) { for (var i = 0, c = popCount(); i < c; ++i) func(cm); } | 66 | return function(cm) { iterTimes(function () { func(cm); }); }; |
14 | } | 67 | } |
15 | 68 | ||
16 | function iterObj(o, f) { | 69 | function iterObj(o, f) { |
17 | for (var prop in o) if (o.hasOwnProperty(prop)) f(prop, o[prop]); | 70 | for (var prop in o) if (o.hasOwnProperty(prop)) f(prop, o[prop]); |
18 | } | 71 | } |
72 | function iterList(l, f) { | ||
73 | for (var i in l) f(l[i]); | ||
74 | } | ||
75 | function toLetter(ch) { | ||
76 | // T -> t, Shift-T -> T, '*' -> *, "Space" -> " " | ||
77 | if (ch.slice(0, 6) == "Shift-") { | ||
78 | return ch.slice(0, 1); | ||
79 | } else { | ||
80 | if (ch == "Space") return " "; | ||
81 | if (ch.length == 3 && ch[0] == "'" && ch[2] == "'") return ch[1]; | ||
82 | return ch.toLowerCase(); | ||
83 | } | ||
84 | } | ||
85 | var SPECIAL_SYMBOLS = "~`!@#$%^&*()_-+=[{}]\\|/?.,<>:;\"\'1234567890"; | ||
86 | function toCombo(ch) { | ||
87 | // t -> T, T -> Shift-T, * -> '*', " " -> "Space" | ||
88 | if (ch == " ") return "Space"; | ||
89 | var specialIdx = SPECIAL_SYMBOLS.indexOf(ch); | ||
90 | if (specialIdx != -1) return "'" + ch + "'"; | ||
91 | if (ch.toLowerCase() == ch) return ch.toUpperCase(); | ||
92 | return "Shift-" + ch.toUpperCase(); | ||
93 | } | ||
19 | 94 | ||