pub enum Stmt {
Show 32 variants
Echo(Vec<Expr>),
Echon(Vec<Expr>),
Let {
target: LetTarget,
expr: Expr,
},
Call(Expr),
Expr(Expr),
If {
arms: Vec<(Expr, Vec<Stmt>)>,
else_body: Option<Vec<Stmt>>,
},
While {
cond: Expr,
body: Vec<Stmt>,
},
For {
vars: ForVars,
iter: Expr,
body: Vec<Stmt>,
},
Break,
Continue,
Finish,
Return(Option<Expr>),
Function {
name: String,
args: Vec<String>,
defaults: Vec<(usize, Expr)>,
body: Vec<Stmt>,
bang: bool,
vim9: bool,
},
Try {
body: Vec<Stmt>,
catches: Vec<(Option<String>, Vec<Stmt>)>,
finally: Option<Vec<Stmt>>,
},
Throw(Expr),
Execute(Vec<Expr>),
Set(String),
Source(String),
Unlet(Vec<UnletArg>),
Map(String),
CommandDef(String),
CommandDel(String),
DelFunction(String),
UserCmd(String),
Autocmd(String),
Augroup(String),
Doautocmd(String),
ExCmd(String),
Colorscheme(String),
Highlight(String),
Syntax(String),
Filetype(String),
}Expand description
A Vimscript statement (one ex-command’s worth of work).
Variants§
Echo(Vec<Expr>)
:echo expr ….
Echon(Vec<Expr>)
:echon expr ….
Let
:let target = expr.
Call(Expr)
:call funcref(args).
Expr(Expr)
A bare expression (REPL / -e).
If
:if … :elseif … :else … :endif. Each arm is (condition, body); the
optional trailing else body has no condition.
Fields
While
:while {cond} … :endwhile.
For
:for {var} in {expr} … :endfor (list iteration).
Fields
Break
:break.
Continue
:continue.
Finish
:finish — stop sourcing the rest of the current script/file.
Return(Option<Expr>)
:return [expr].
Function
:function {name}(args) … :endfunction.
Fields
Try
:try … :catch {pat} … :finally … :endtry.
Fields
Throw(Expr)
:throw {expr}.
Execute(Vec<Expr>)
:execute expr … — concatenate the values (space-separated) and run the
result as an ex command line.
Set(String)
:set {args} — set options (the raw argument text).
Source(String)
:source {file} — read and run another .vim file in the current scope
(its functions and globals persist). The raw (unquoted) filename.
Unlet(Vec<UnletArg>)
:unlet[!] {name}… — delete one or more variables, list items, or dict
entries. Each argument is either a bare name or a List/Dict element
target (l[i] / d.key); see UnletArg.
Map(String)
A :map-family command (nmap, inoremap, vunmap, mapclear, …):
the whole raw command line, re-parsed by the mapping runtime.
CommandDef(String)
:command[!] [-attrs] Name {repl} — define a user command (raw args).
CommandDel(String)
:delcommand {name} — delete a user command.
DelFunction(String)
:delfunction[!] {name} — remove a user function from the registry.
The raw argument (optional leading !, then the name) is resolved at
run time, mirroring how :call/exists('*…') key the function table.
UserCmd(String)
Invocation of a user command (:Name args): the whole raw line,
resolved against the user-command table at run time.
Autocmd(String)
:autocmd[!] {event} {pat} {cmd} — register an autocommand (raw args).
Augroup(String)
:augroup {name} / :augroup END — set the active autocommand group.
Doautocmd(String)
:doautocmd {event} [{pat}] — fire matching autocommands.
ExCmd(String)
A :-prefixed or %-prefixed Ex command line with an optional line
range (:%s/…, :1,3d, %g/…/d): the whole raw line, parsed and run
against the current buffer at run time.
Colorscheme(String)
:colorscheme {name} (:colo) — select a color scheme. Sources the
matching colors/{name}.vim from the runtime path (firing its
:highlight commands) and records g:colors_name. The raw name; empty
for the bare :colorscheme query.
Highlight(String)
:highlight [default] {group} {key}={val}… (:hi) — define a highlight
group. The raw argument text; parsed at run time into the highlight
registry and mirrored to an embedding editor via the highlight host hook.
Syntax(String)
:syntax … (:syn) — syntax-highlighting control. Recognized so real
vimrc files parse; the raw argument text is forwarded to an optional host
hook (an embedding editor may enable its own highlighter) and is
otherwise a no-op standalone.
Filetype(String)
:filetype … (:filet) — filetype-detection control. Recognized so real
vimrc files parse; forwarded to an optional host hook and otherwise a
no-op standalone.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stmt
impl RefUnwindSafe for Stmt
impl Send for Stmt
impl Sync for Stmt
impl Unpin for Stmt
impl UnsafeUnpin for Stmt
impl UnwindSafe for Stmt
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more