Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata (tmPreferences) files - indentation setting "preserveIndent" #217

Open
keith-hall opened this issue Jul 8, 2016 · 5 comments
Open

Comments

@keith-hall
Copy link
Contributor

The documentation on metadata/tmPreferences files (http://docs.sublimetext.info/en/latest/reference/metadata.html) doesn't mention the preserveIndent setting.

As an example, this setting is currently (true as of build 3118) set to true in the Default package Indentation Rules - Comments.tmPreferences file, for the comment scope. More info here: sublimehq/sublime_text#1271 (comment)

@FichteFoll
Copy link
Collaborator

I noticed a few of these settings, notably batch*IndentPattern, but have no idea what they do compared to the non-batch version. Do you know?

The others should be simple enough to be mentioned, so thanks for the heads-up.

@keith-hall
Copy link
Contributor Author

Unfortunately, I have absolutely no idea how the batch patterns differ from the "normal" ones... It doesn't seem to be a TextMate thing, because they are not mentioned here: https://manual.macromates.com/en/preferences_items.html


The only difference I have noticed, while experimenting with the indentation rules, is that changing decreaseIndentPattern to batchDecreaseIndentPattern and increaseIndentPattern to batchIncreaseIndentPattern stops it from changing the indentation as you type, though it still works with the reindent command...
i.e. in HTML (which uses the batch rules), it doesn't change the indentation after typing Enter <div> Enter or Enter </div> Enter, but in XML (which doesn't use the batch rules), it does change the indentation. Confirmed by changing the tmPreferences file.

@FichteFoll
Copy link
Collaborator

stops it from changing the indentation as you type, though it still works with the reindent command

Ah, that could be it exactly (and would also make sense with their naming). Basically, batch* patterns are only applied when reindenting blocks (i.e. multiple lines of code) while the normal patterns also apply when auto_indent is true and a newline is inserted.

@keith-hall
Copy link
Contributor Author

just wanted to make a note here that I have listed a lot of indentation engine info at https://forum.sublimetext.com/t/everything-you-n-ever-wanted-to-know-about-indentation-in-st3/26207 which we could pull into the undocs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants