pub struct FoldLevel;Expand description
Folds nested deeper than this level are closed; the rest are
open. The outermost fold is level 1, so foldlevel=0 closes
everything and foldlevel=1 shows only the top level’s
structure. In a multibuffer view that means 0 gives one row
per file and 1 gives one row per excerpt.
Setting it is a bulk action, applied at the moment of the
:set. Afterwards za / zo / zc adjust individual folds
without changing the option, and a fold whose state the user has
touched keeps it across rebuilds – foldlevel only decides the
initial state of folds that appear later.
Default deviates from vim deliberately. Vim defaults this to
0, which is why practically every vimrc carries
set foldlevelstart=99 – the default means “open every file
fully collapsed”, which few people want. Lattice would suffer
that worse than vim does: foldmethod defaults to manual, so
an ordinary document has no folds, but overlay fold sources are
always registered (multibuffer file/excerpt folds, diff hunk
folds, the AI conversation’s tool-call folds). A 0 default
would open every search result, project diff and agent transcript
collapsed to nothing. 99 is the effective-infinity value the
vim idiom settled on, and it keeps the shipped behaviour.
Implementations§
Source§impl FoldLevel
impl FoldLevel
Sourcepub fn build_spec() -> Option<i64>
pub fn build_spec() -> Option<i64>
Build the runtime spec for this declaration.
Used by the registry’s self-registration boot
path; not generally called by hand. Direct
construction of Option<T> is the macro’s
internal-only path – consumer code uses
config.get_typed::<#name_ident>() to read
and config.set_typed::<#name_ident>(...) to
write.
Trait Implementations§
Source§impl HasGroup for FoldLevel
impl HasGroup for FoldLevel
Source§const GROUP_NAME: &'static str = <crate::Editor as ::lattice_config::OptionGroup>::NAME
const GROUP_NAME: &'static str = <crate::Editor as ::lattice_config::OptionGroup>::NAME
"editor", "lsp", …). The macro
pulls this from the group = SomeGroup; directive at the
declaration block’s head.Source§impl OptionDecl for FoldLevel
impl OptionDecl for FoldLevel
Source§const NAME: &'static str = FoldLevel
const NAME: &'static str = FoldLevel
:set <NAME>=…,
TOML keys, completion candidates, :describe-option.
Internal access is type-driven. The macro derives this
from the option’s identifier (with namespace prefix when
declared via mode_options!); manually-typed NAMEs are
not supported for built-in options.Source§const DOC: &'static str = FoldLevel
const DOC: &'static str = FoldLevel
:describe-option, the :customize
form’s per-row help, and :apropos results.Source§const CUSTOMIZABLE: bool = true
const CUSTOMIZABLE: bool = true
true (the default) ⇒ option
appears in :set autocomplete + the :customize group
view. false ⇒ plugin / engine-internal state, hidden
from user surfaces. Equivalent of emacs’s defvar vs
defcustom. (See mode-architecture.md §6.5.3.)Source§fn default_value() -> Self::Value
fn default_value() -> Self::Value
const) so non-const-constructible types like String
can be defaults.