I beheld quite a few usage of "function!" in others vimrc files, but there is no easy-to-find documentation of "function!".
What's the difference between "function" and "function!"?
I beheld quite a few usage of "function!" in others vimrc files, but there is no easy-to-find documentation of "function!".
What's the difference between "function" and "function!"?
In general, it suppresses the messages the command may spit out.
For instance, using function!
, you can redeclare an already defined function.
:help user-functions
When a function by this name already exists and [!] is
not used an error message is given. When [!] is used,
an existing function is silently replaced. Unless it
is currently being executed, that is an error.
function
(with appropriate) parameters defines a new function but fails if a function already exists with the given name. function!
will always replace any existing function of the given name with the new definition supplied.
This says as much:
:help function