pub struct Registers {
pub unnamed: Slot,
pub yank_zero: Slot,
pub delete_ring: [Slot; 9],
pub named: [Slot; 26],
pub clip: Slot,
pub filename: Option<String>,
/* private fields */
}Fields§
§unnamed: Slot" — written by every yank / delete / change.
yank_zero: Slot"0 — last yank only.
delete_ring: [Slot; 9]"1–"9 — last 9 deletes ("1 newest).
named: [Slot; 26]"a–"z — named user registers.
clip: Slot"+ / "* — system clipboard register. Both selectors alias
the same slot (matches the typical Linux/macOS/Windows setup
where there’s no separate primary selection in our pipeline).
The host (the host) syncs this slot from the OS clipboard
before paste and from the slot back out on yank.
filename: Option<String>"% — synthetic read-only register: current buffer filename.
Set by the host whenever the active slot changes.
Implementations§
Source§impl Registers
impl Registers
Sourcepub fn record_yank(
&mut self,
text: String,
linewise: bool,
target: Option<char>,
)
pub fn record_yank( &mut self, text: String, linewise: bool, target: Option<char>, )
Record a yank operation. Writes to ", "0, and (if
target is set) the named slot. When target is '_'
(black-hole register) all writes are suppressed — vim discards
the text without touching any register.
Sourcepub fn record_delete(
&mut self,
text: String,
linewise: bool,
target: Option<char>,
)
pub fn record_delete( &mut self, text: String, linewise: bool, target: Option<char>, )
Record a delete / change. Writes to ", rotates the
"1–"9 ring, and (if target is set) the named slot.
Empty deletes are dropped — vim doesn’t pollute the ring
with no-ops. When target is '_' (black-hole register) all
writes are suppressed, preserving the previous register state.
Sourcepub fn read(&self, reg: char) -> Option<&Slot>
pub fn read(&self, reg: char) -> Option<&Slot>
Read a register by its single-char selector. Returns None
for unrecognised selectors.
'%' is a synthetic read-only register: returns the current buffer
filename when one has been set via Registers::set_filename.
Sourcepub fn set_filename(&mut self, name: Option<String>)
pub fn set_filename(&mut self, name: Option<String>)
Host hook: set the "% register to the given filename. Call this
whenever the active buffer changes.
Sourcepub fn set_clipboard(&mut self, text: String, linewise: bool)
pub fn set_clipboard(&mut self, text: String, linewise: bool)
Replace the clipboard slot’s contents — host hook for syncing
from the OS clipboard before a paste from "+ / "*.