I pasted some code and the code was not indented. Is there a "reindent" option like the one employed by SublieText?
If not, kindly consider it a a feature.
The CodeMirror action is indentAuto, but I don't think it's bound to a key by default in the notebook. The default CM keybinding for this is Shift-Tab, but I think we override Shift-Tab to indentLess instead, which is already available as ctrl/cmd-[.
I am not sure if we're on the same track. I don't mean auto-indent which is already present. I mean to be able to re-indent a code block with a click or shortcut instead of doing it manually.
Then I don't know what you mean by re-indent. We have
What do you want reindent to do?
@minrk I am not sure if indentAuto is capable of this but nothing in the menu offers this and neither a shortcut.
This sums it up: It鈥檚 useful if you need to change a document from using spaces to tabs, for instance.
and here: The Reindent command is handy for quickly formatting a messy block of HTML.
It helps a lot if you have an unindented block or not correctly indented one.
Gotcha, that's what indentAuto does. There isn't a default shortcut for it at the moment in the notebook, but we should be able to add it, either via the menu or keyboard shortcut.
Great. Looking forward to it.
Thanks for the shortcut though this is not what I was implying. I made a screencast to show this.
Sorry for the duplicate posts.
What you want was discontinued from CodeMirror, you should be able to write an extension that does it:
Cf this SO question for example : http://stackoverflow.com/questions/25109809/codemirror-auto-format-after-setvalue. It's though, something which is hard with Python as various indentation have various meaning.
Most helpful comment
Gotcha, that's what indentAuto does. There isn't a default shortcut for it at the moment in the notebook, but we should be able to add it, either via the menu or keyboard shortcut.