Folding Theory

Folding Theory

Content #

  1. Each line of code in a file has a “foldlevel”. This is always either zero or a positive integer.
  2. Lines with a foldlevel of zero are never included in any fold.
  3. Adjacent lines with the same foldlevel are folded together.
  4. If a fold of level X is closed, any subsequent lines with a foldlevel greater than or equal to X are folded along with it until you reach a line with a level less than X.

Some rough “rules” for our folding(foldmethod is indent):

  1. lines that are indented should be folded together, and the previous line folded with them.
  2. Blank lines should be at the same level as later lines, so blank lines at the end of a fold won’t be included in it.

From #