Sublime Text bindings demo

The sublime keymap defines many Sublime Text-specific bindings for CodeMirror. See the code below for an overview.

Enable the keymap by loading keymap/sublime.js and setting the keyMap option to "sublime".

(A lot of the search functionality is still missing.)

AخA
          cm.replaceRange(" ", Pos(actual), Pos(actual + 1, /^\s*/.exec(cm.getLine(actual + 1))[0].length));
 
1
// The bindings defined specifically in the Sublime Text mode
2
var bindings = {
3
  "Alt-Left": "goSubwordLeft",
4
  "Alt-Right": "goSubwordRight",
5
  "Ctrl-Up": "scrollLineUp",
6
  "Ctrl-Down": "scrollLineDown",
7
  "Shift-Ctrl-L": "splitSelectionByLine",
8
  "Shift-Tab": "indentLess",
9
  "Esc": "singleSelectionTop",
10
  "Ctrl-L": "selectLine",
11
  "Shift-Ctrl-K": "deleteLine",
12
  "Ctrl-Enter": "insertLineAfter",
13
  "Shift-Ctrl-Enter": "insertLineBefore",
14
  "Ctrl-D": "selectNextOccurrence",
15
  "Shift-Ctrl-Space": "selectScope",
16
  "Shift-Ctrl-M": "selectBetweenBrackets",
17
  "Ctrl-M": "goToBracket",
18
  "Shift-Ctrl-Up": "swapLineUp",
19
  "Shift-Ctrl-Down": "swapLineDown",
20
  "Ctrl-/": "toggleComment",
21
  "Ctrl-J": "joinLines",
22
  "Shift-Ctrl-D": "duplicateLine",
23
  "Ctrl-T": "transposeChars",
24
  "F9": "sortLines",
25
  "Ctrl-F9": "sortLinesInsensitive",
26
  "F2": "nextBookmark",
27
  "Shift-F2": "prevBookmark",
28
  "Ctrl-F2": "toggleBookmark",
29
  "Shift-Ctrl-F2": "clearBookmarks",
30
  "Alt-F2": "selectBookmarks",
31
  "Alt-Q": "wrapLines",
32
  "Ctrl-K Ctrl-Backspace": "delLineLeft",
33
  "Backspace": "smartBackspace",
34
  "Ctrl-K Ctrl-K": "delLineRight",
35
  "Ctrl-K Ctrl-U": "upcaseAtCursor",
36
  "Ctrl-K Ctrl-L": "downcaseAtCursor",
37
  "Ctrl-K Ctrl-Space": "setSublimeMark",
38
  "Ctrl-K Ctrl-A": "selectToSublimeMark",
39
  "Ctrl-K Ctrl-W": "deleteToSublimeMark",