Tab indentation in Jupyter Notebook - lmmx/devnotes GitHub Wiki
There's some documentation on how to change the default number of spaces with indentUnit
IPython.Cell.options_default.cm_config.indentUnit = 2;
To use tabs (which is the formatting standard in Go for example) the relevant setting is exposed through the custom.js
file, e.g. in
~/.ipython/profile_default/static/custom/custom.js
~/.ipython/profile_julia/static/custom/custom.js
Through adding:
CodeMirror.defaults.indentWithTabs=true;
The relevant Javascript run to access it is in codemirror.js
(as of Jupyter v.4.0.6):
if (cm.options.indentWithTabs)
for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
if (pos < indentation) indentString += spaceStr(indentation - pos);
i.e. it approaches indentation
in steps of tabSize
through addition/removal of string indentString
, "\t"
This will probably not be that useful for Go, since it's compiled and the IPy/Jupyter kernel developers have accordingly stopped work on it.