CodeMirror JavaScript codes are different for your version and demo :
In the demo version, near line 2036, there is the following code that is missing from your version:
defaultTab: function(cm) { if (cm.somethingSelected()) cm.indentSelection("add"); else cm.replaceSelection("\t", "end"); }
Along with a set of functions related to CodeMirror.keyMap .
Compare the two and combine the missing bits or just use the script from the demo version.
James simm
source share