Skip to content

Instantly share code, notes, and snippets.

@marijnh
Created November 2, 2012 09:23
Show Gist options
  • Save marijnh/3999709 to your computer and use it in GitHub Desktop.
Save marijnh/3999709 to your computer and use it in GitHub Desktop.
function indentOnBrace(cm) {
var cursor = cm.getCursor(), line = cm.getLine(cursor.line);
var indent = cursor.ch == 0 || /^\s*$/.test(line.slice(0, cursor.ch));
cm.replaceSelection("}", "end");
if (indent) cm.indentLine(cursor.line);
}
instance.setOption("electricChars", false);
instance.setOption("extraKeys", {"'}'": indentOnBrace});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment