Smart tabs for code indentation

Matt Long 7 years ago • updated by Kroum Tzanev 5 years ago 3
Just started playing with ST2 today -- so far I love it. One thing I would like to see is better code indenting. The "best" way I've found is "smart tabs" that use tabs for indent and spaces for alignment, See: http://www.emacswiki.org/emacs/SmartTabs

The best thing about this is that it survives being opened in a variety of editors without looking like garbage.
I have been doing this manually like forever. Of course, it would be really nice to have a single hot key insert all the spaces; however, I believe this would require further knowledge of the syntax of the current file’s programming language than Sublime Text 2 has.
To scratch my own itch in a sub-optimal way, I've rewritten the AutoFormat plugin and produced an AstyleFormat plugin (https://github.com/robothor/AstyleFormatPlugin). If you put the correct options in your ~/.astylerc it will format code properly.

This has both command and on_pre_save hooks. The next problem is to get it to save and reset the edit position -- right now it will bump you to the end of the file after reformatting.

I agree.

It will be nice to have option smart for the existing ST2 setting:

"translate_tabs_to_spaces": [true|false]