Auto indent braces in code

Does anyone know how to auto indent curly braces in obsidian while typing code?

The default behavior is this:

for(int i=0; i<n; i++){
|
}

But I want it to be automatically indented, with spaces equivalent to a tab, after pressing enter key, like this:

for(int i=0; i<n; i++){
    |
}
1 Like