Basically, I’m looking for a way to simulate how folding works in mainstream outliners (an example that may be familiar is Workflowy)
There are 2 ways in which sublime’s folding behavior diverge from the behavior I have in mind
-
In sublime, if you execute the fold command while caret is on a given line, that line itself became folded up (hence now invisible). By contrast, in most outliners, it is the content below, and “in the scope of” (i.e. have deeper indentation), the current line, that gets folded. Thus if you want to fold up the body of a function (but leave the function definition line visible), and if the caret is current on the function definition line, you must move caret down a line, then fold.
-
In sublime, but not in most outliners, triggering the folding command results in the folded region being selected. Thus if all one wants to do is to simply hide some section of code, there’s a further step of deselection that must be carried out, making the workflow a bit less smooth.
(Incidenally, as far as I can see, the default folding behavior of vscode seems identical to mainstream outliners on point 1 and 2, and hence different from sublime’s)
Now, the folding behavior that I want is present in sublime. I know this because it’s exactly the same behavior as triggered by clicking on the folding arrow in the gutton.
However I’ve never been able to figure out what the command for triggering “gutter folding” is, or if it exists.
Could someone help me out? If the command doesn’t exist, do you think there’s a way to simulate the effect of clicking on gutter arrow?
Thanks!