An addendum to CodeMirror's keyMap
documentation, which unfortunately glosses over the 'connecting the wires' section.
CodeMirror.keyMap.tabSpace = {
Tab: function(cm) {
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
cm.replaceSelection(spaces, "end", "+input");
},
fallthrough: ['basic']
};