> :let {var} ?= {expr} This is a conditional variable assignment operator, > it only has an effect if the variable is not yet > defined. This statement: > > let foo ?= "bar" > > is exactly equivalent to this: > > if !exists("foo") > let foo = "bar" > endif
Along those lines, why not define a conditional attribute that would apply to functions? :fu[nction][!?] {name}([arguments]) [range] [abort] [dict] ... When a function by this name already exists and [!] or [?] is not used an error message is given. When [!] is used, an existing function is silently replaced; when [?] is used, the function is ignored. The same goes for :command[?]