nx.view
nx.view.component(def)
nx.view.component(def) — the view-backed component (a focus-taking nx.view buffer): the
common case (file tree, list, modal dialog). Sugar over nx.component with the view
backend; mount(opts) takes the view surface options (name / filetype / dock / split /
float), plus persist = "<id>" (+ optional namespace) to make the view survive a
restart — see the Persistence note on nx.component above.
Defined in component.lua.
nx.view.actions.confirm()
No documentation comment in the prelude.
Defined in view.lua.
nx.view.create(opts)
nx.view.create{ name?, filetype?, persist?, namespace? } -> handle. Mints the backing
read-only buffer (off-screen until mounted) and returns the handle. filetype drives
treesitter / decoration on the view buffer.
persist opts the view into cross-session restore: it is a stable, plugin-chosen string
id (instance-unique within the plugin) that core round-trips through the workspace
session — recording only (namespace, id) + the view’s slot, never its content. On
restore core reserves the slot and hands the id back via nx.view.on_restore, and the
plugin (which keyed its own nx.shada.plugin() store by the same id) rebuilds the
content. Absent ⇒ the view is ephemeral (today’s behavior — not persisted). The owning
namespace is auto-derived from the calling plugin’s location (same resolver as
nx.shada.plugin()); opts.namespace is the escape hatch for a context that attributes
to no runtimepath entry (a bare :lua / RPC / test) and is an error from a real plugin
file — exactly the nx.shada.plugin(dev_namespace) contract.
Defined in view.lua.
nx.view.pending_restores()
nx.view.pending_restores() -> the views a session restore reserved a slot for but that
no plugin has adopted yet, each { namespace=, id=, win= } (win is the reserved
window). The pull primitive behind nx.view.on_restore and the black-box test hook.
Refreshed each tick from core’s nx._view_pending mirror.
Defined in view.lua.
nx.view.on_restore(fn, namespace)
No documentation comment in the prelude.
Defined in view.lua.