I Have a problem like that
but answer in link above don't helped me. I get used to reindent whole file while coding and I liked Sublime Text very much. But this bug makes me mad. So I need to reindent whole PHP files with shortcut and don't get wrong indenting.
This is how i need:
And this is how it does:
That's quite simple in Sublime. Just Ctrl+Shift+P (or Command+Shift+P on MacOS) to open the tools pallet, type reindent , and pick Indentation: Reindent Lines . It should reindent all the file you are in, just remember to save before running the command, or it may not appear.
Using Sublime Alignment ↩ Select the lines you wish to align. Press Ctrl+Alt+A (Windows & Linux) or Command+Ctrl+A (Mac OS X)
You can use ctrl+ ] to indent a line (or highlighted block), and ctrl + [ to unindent.
As @BullfrogBlues mentions in a comment, the Sublime PHP Grammar plugin has a fix for this. I did not want that entire package, but fortunately it is very easy to extract out just the array indentation rule from there:
https://github.com/gerardroche/sublime-php-grammar/blob/master/Indentation%20Rules%20-%20Arrays.tmPreferences
Just save that file into the same directory where all your custom snippets etc. go (on Mac it's ~/Library/Application Support/Sublime Text 3/Packages/User
, not sure about Windows/Linux) and voila!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With