pub enum AutoWrap {
Off,
Comments,
All,
}Expand description
:set autowrap=.... Whether inserting a character past
textwidth breaks the line and carries the remainder down.
§Why this exists as one named option
Vim has no toggle for this at all — it is formatoptions, a bag
of nineteen single-letter flags of which t (wrap text) and c
(wrap comments) are the two anyone means. That is why nobody
remembers them. Emacs has auto-fill-mode, which names a 1980s
implementation (“filling”) rather than the effect.
§Why it is an option and not a minor mode
It owns no keymap, no lifecycle subscription, no decoration
provider and no buffer — it is a behaviour flag consulted on the
insert path, which is exactly what electricindent (IN.6)
already is. Same seam, same per-major override mechanism via
Mode::options(). A mode that is really a bool is a mode in name
only.
§Not to be confused with wrap
wrap is SOFT wrap — a display decision, no bytes change. This
inserts real newlines. The two are orthogonal and compose: a
buffer may soft-wrap at the window edge while hard-wrapping at
textwidth.
Variants§
Off
Never break a line while typing. gq still reflows on
demand — textwidth remains the measure either way.
Comments
Break only inside comments, judged by the line’s leading comment marker. The default for code: a long comment wraps, a long string literal does not.
All
Break any line past textwidth. The default for prose
majors — markdown, org, text, git commit messages.
Implementations§
Trait Implementations§
impl Copy for AutoWrap
impl Eq for AutoWrap
impl StructuralPartialEq for AutoWrap
Auto Trait Implementations§
impl Freeze for AutoWrap
impl RefUnwindSafe for AutoWrap
impl Send for AutoWrap
impl Sync for AutoWrap
impl Unpin for AutoWrap
impl UnsafeUnpin for AutoWrap
impl UnwindSafe for AutoWrap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.