Home

foldlevel

Foldlevel is a numeric setting used by text editors and integrated development environments to control how code folds are displayed. Code folding allows blocks of text to be collapsed into a single line or summary, helping users manage large files by focusing on structure rather than details. Foldlevel determines how deep nested fold regions should be expanded when a file is opened or the editor refreshes its view; folds deeper than the specified level are collapsed. While the core idea is consistent, the precise interpretation and default values can vary between editors and folding methods.

In editors that support explicit folding methods—such as Vim with foldmethod (manual, syntax, indent, marker, etc.)—foldlevel

The concept is generally display-oriented: foldlevel does not alter the underlying text, only its presentation. Changes

See also: foldmethod, foldexpr, foldtext.

works
in
concert
with
those
methods.
It
typically
affects
which
folds
are
open
by
default
after
loading
a
file.
A
higher
foldlevel
reveals
more
nested
content,
while
a
lower
foldlevel
hides
more
of
the
folds.
Some
environments
also
provide
a
foldlevelstart
setting
to
influence
initial
visibility
when
reopening
a
file.
Users
can
usually
override
the
default
by
issuing
commands
to
adjust
the
foldlevel
or
by
manually
opening
and
closing
folds
(for
example,
through
keyboard
shortcuts
or
on-screen
controls).
to
the
folding
method
or
to
the
structure
of
the
file
can
change
how
fold
levels
are
computed.
In
some
systems,
folds
may
be
stored
in
the
file
or
computed
on
the
fly,
which
can
affect
consistency
across
sessions.