As already noted in the accepted answer, this is by default (but for the textarea, not the code editor).
However, a (quite uncomfortable) workaround is using the code snippet (the symbol <>
in the toolbar) to write your code: it automatically indents 2 spaces when you hit tab. It's meant for JavaScript, but you can use it the way you want. On top of that, the code snippet has a handy beautifier (named tidy
) function.
Here is an example.
function foo(){
return baz;
//look ma, I used tab here
};
Of course, you have to remove the lines...
<!- begin snippet: js hide: false console: true babel: false ->
<!- end snippet ->
... that the snippet generates (unless your question is actually about JavaScript and the snippet is runnable).
That being said, the best idea is still using your favourite code editor and copy/pasting the code.
tab
key and make it behave differently. At any rate, this should probably a feature-request.