In C++, ‘#’ should generally start from the beginning of the line. At least it’s the most common style to type #ifdef … at the beginning of the line. I would love if Sublime would do that automatically by removing indentation when # is typed and there is nothing on the left of it besides whitespace. Or maybe can someone come up with keyboard binding or plugin that does that?
Unindent on typing '#' in C++ syntax
jonte
#3
I find it more readable to indent preprocessor directives for the same reasons as indenting normal code. I guess it’s up to personal taste. I’d be fine with this as optional behaviour though.
0 Likes
rchl
#4
jonte, OK, but major IDE’s (VS, XCode) unindent automatically on inserting ‘#’ character so this probably means that this is more comment style. And more importantly, my company follows that style and thus also me.
So I’ve made a simple plugin to do that - github.com/rchl/UnindentPreprocessor
Eventually will probably appear on Package Control so will be easier to get. For now on github only.
0 Likes