-
Notifications
You must be signed in to change notification settings - Fork 366
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
Add Better code folding #433
base: master
Are you sure you want to change the base?
Conversation
Better Fold Sections.
Thank you for these patches! Now I really have no excuse not to pull them
|
Add Preamble fold support
Is the patch in effect in the latest LaTeXTools? The shortcuts does not work even when there are Thank you. |
Not yet... Sorry! I do plan on pulling it as soon as I have some time this
|
3041ae1
to
9a86aef
Compare
This sounds like a great feature! Hopefully it gets pulled in! |
c49c2ff
to
bd5a43f
Compare
Better code folding
By default, sublime text use "%(fold)" and "%...(end)" marks and "tabs" to identify code folding sections in latex source files.
This feature supplies a better code folding behavior. It can recognize "%(fold)" and "%...(end)" mark pairs, if you forget to use this mark, it all OK too. If the marks of "%(fold)" and "%...(end)" are not used, it will auto pair the code folding sections to the next same level's "section start mark" or "parents' start marks". For example, for the code bellow:
wil be folded to
shortcut for code folding
Better code folding can ONLY be used by shortcuts!
By default, all of the shortcut bellow can be used.
"Alt+Super+[", "Super+k, Super+1", "Super+k, Super+2", "Super+k, Super+3",
... "Super+k, Super+7" are now can be used in latex source file even there are no "tab" used in source files.
And there are three special shortcuts, which are:
"Super+k, Super+o": unfold current foding. I don't know why set this command to the shortcut of "Alt+Super+]" does not work for me, so I set it to "Super+k, Super+o" as alternative.
"Super+k, Super+9": fold whole buffer to "Table of Content", which is called "fold to toc".
"Super+k, Super+0": fold whole buffer to TOC but keep the current editing section unfold.
About fold_to_toc command
Example of fold to toc(Super+k, Super+9) is like this:
If source cod is :
will be fold to
if "Super+k, Super+0" is triggered, it will be folded to
it can be seen that the in the fold to toc command, fold marks of "%(fold)" and "%...(end)" are ignored.
"fold_toc_depth" options
There is a "fold_toc_depth" option, which controls the depth of fold_to_toc command fold the buffer.
When "fold_toc_depth" is not set, 4 will be used as default value. If option is set to
in LaTeXtools config files, and the code like
will be folded to
which means \subsection, \subsubsection and others will be folded into \subsection
About extreme fold
These is another fold mode called extreme fold. When extreme fold is used, all fold marks of "%(fold)" and "%...(end)" will be ignored. extreme fold is used only in "fold to toc" by default, but it can be set to other scopes by change the "extreme_fold" option in "laTeXTools.sublime-settings". Detailed description can be found in "laTeXTools.sublime-settings" file.