1

I am currently using php-mode with spacemacs to write in php and recently I noticed this auto-indent behavior, namely pressing TAB.

switch ($cond) {
    case "something":
    break;
}

Auto indenting this region becomes

switch ($cond) {
case "something":
break;
}

I know that in js2-mode for javascript a variable called js-switch-indent-offset do the trick, but couldn't find the one related to php so far.

1

You can customize the indent level of the switch case for PHP like this:

(c-set-offset 'case-label 4)

This should work for any language that's based on the c-mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.