Is there a way to express this in the XML indentation tmpreferences? If not, would it be possible to express via a plugin? And is there any documentation for the XML stuff in the pristine packages directory.

I have spent a little more time thinking about this and I think I have a solution. I wanted to run it by the fora in hopes of getting a comment.

The solution I've come up with is to create a new indent function that behaves like the normal tab except in certain special circumstances. Any time I am within a parenthesis ("()") or angle bracket ("<>") block, I need to indent to the previous line's column if there is anything on it, or to two indents below the previous line if not. I also need to do this whenever the user inserts a newline.

I should be able to add a small Python extension to my user directory to implement this with very little trouble. Any time I'm in a C++ file, I would override tab and return with my new commands, which would just search back to the previous (, ), <, >, or ;, and calculate the desired start position of the cursor from that point.

Do you think that this would work? Are there more efficient solutions I am overlooking? Thanks for your feedback.

That sounds like it could work. You can tell if you're inside parens by seeing if your scope is "meta.parens.c meta.function.c source.c", and then you can use expand_selection with the "scope" argument to set the beginning of the selection to just before the opening parenthesis. If it's the last character on the line, indent the next line with two tabs (view.insert(edit,pt,"\t\t") will work even if you're using spaces to indent); if not, use view.rowcol to get the column, add one to account for the width of the parenthesis, and indent the next line that far.Good luck!

In order to avoid reimplementing or breaking other tabbing behavior, I should probably make my plugin keep a setting describing when it is active. For example, it could be active in C++ or Java scopes only. I can also make a command within my plugin to return whether the plugin should be given the current point or selection. Using that command, I would add something like this to the keymap:

The should_indent_to_column command checks whether I'm in the right scope. The indent to column command always indents selected lines to the correct column. This won't behave quite right when there are parts of a region that are inside parens and parts outside. For that I'd want to apply my specialized indenting behavior to one part and the ordinary indenting behavior to the other. But for that I suspect we would need some more unified view of auto-formatting than I think we have available at the moment.