Expand description
Flat directory listing buffer — oil.nvim-style editable view.
The buffer’s text is one bare filename per line. Bare is
load-bearing: apply() diffs that text against the open-time
snapshot to derive the renames / deletes / creates to execute, so
anything decorative in it would be read as a filename. Icons are
leading virtual text published by directory-listing-mode (DL.3b)
for exactly this reason.
DL.5: the buffer itself is an ordinary actor-backed Document — oil is writable, so its edits take the normal document path with no bespoke rope-mutation detour, and it paints through the shared compose path like every other kind.
§Where does “the dir this oil buffer represents” live?
Not on the snapshot. M.3.2.c.5 retired the struct-stored dir
field; the canonical answer is the OilDir BufferLocal
owned by oil-mode. The App reads it from
buffer_locals[id].get::<OilDir>() and passes it into the
OilBuffer methods that need it ([OilBuffer::open],
[OilBuffer::reload], [OilBuffer::apply]) as an explicit
&Path parameter.
That design forces a single source of truth (the buffer-local)
and makes the per-buffer mode-owned state uniform across every
buffer kind: a reader does buffer_locals[id].get::<T>() and
never branches on BufferKind. :describe-buffer enumerates
every contributed local through the same path. Forgetting to
re-mirror state after a mutation – the class of bug that
produced “navigate-up corrupts paths” – is impossible by
construction because the buffer-local IS the state. There’s
nothing to mirror.
Re-exports§
pub use modes::OilDir;pub use modes::OilMode;pub use modes::register_oil_modes;
Modules§
- modes
oil-mode– major mode for the oil.nvim-style editable directory listing buffer.
Structs§
- OilEntry
- OilSnapshot
- The directory state an oil buffer diffs against: the entries as
they were at open, or at the last successful
:w.
Functions§
- listing_
entries - Project the snapshot into the shape
directory-listing-modereads.icon_byteis 0 — oil rows are bare names, so the icon leads. - render_
to_ text - Render snapshot entries to a rope — one bare name per line, no icons. The listing text: one bare filename per line, dirs-first alpha.