Inline Fold
A Sublime Text plugin that is useful to fold regions into a single line.
Details
Installs
- Total 166
- Win 72
- Mac 57
- Linux 37
Apr 30 | Apr 29 | Apr 28 | Apr 27 | Apr 26 | Apr 25 | Apr 24 | Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | Apr 6 | Apr 5 | Apr 4 | Apr 3 | Apr 2 | Apr 1 | Mar 31 | Mar 30 | Mar 29 | Mar 28 | Mar 27 | Mar 26 | Mar 25 | Mar 24 | Mar 23 | Mar 22 | Mar 21 | Mar 20 | Mar 19 | Mar 18 | Mar 17 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
Readme
- Source
- raw.githubusercontent.com
InlineFold
A Sublime Text plugin that is useful to fold regions into a single line.
It can be useful to hide long strings (for example, TailwindCSS classes).
If the cursor is on the same line where the text was folded because of the "inline_fold.rules"
,
the text will be shown,
else the text will be folded.
Set Fold Regions Globally
From the top menu, select Preferences > Settings
and specify the "inline_fold.rules"
setting:
Error: language “jsonc” is not supported
// Preferences.sublime-settings
{
"inline_fold.rules": [
{
// Example: <div class="..."></div>
"fold_selector": "string.quoted.single - punctuation.definition.string, string.quoted.double - punctuation.definition.string",
"preceding_text": "class,className",
}
]
}
fold_selector
- [Required] Thefold_selector
is the region that will be folded.preceding_text
- [Optional] The region will be folded only if thepreceding_text
is found before thefold_selector
. InlineFold will scan max one line before finding thepreceding_text
. Multiple words can be specified by separating them with a comma,
(example"preceding_text": "class,className"
).
Set Fold Regions per Syntax
If a rule is specific to a particular syntax, for example, Python.
Open a Python file.
Click Preferences > Settings - Syntax Specific
and specify the "inline_fold.rules"
. Those rules will only apply to Python files:
Error: language “jsonc” is not supported
// Python.sublime-settings
{
"inline_fold.rules": [
{
// Example: view.run_command(...)
// The `- punctuation.section.arguments.begin` will not fold the open bracket
// The `- punctuation.section.arguments.end` will not fold the close bracket
"fold_selector": "meta.function-call.arguments.python - punctuation.section.arguments.begin - punctuation.section.arguments.end",
}
]
}
Examples
Here is a few examples:
Error: language “jsonc” is not supported
{
"inline_fold.rules": [
// Fold TailwindCSS class names
// Example: <div class="..."></div>
{
"fold_selector": "string.quoted.single - punctuation.definition.string, string.quoted.double - punctuation.definition.string",
"preceding_text": "class,className",
},
// [Python] Fold docstring except for the first line of the docs string.
// class Person:
// """
// Some really long docs string. ..."""
{
"fold_selector": "comment.block.documentation.python - punctuation.definition.comment",
}
]
}
For more example go here.