tags:

views:

79

answers:

3

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!"?

+3  A: 

In general, it suppresses the messages the command may spit out.

For instance, using function!, you can redeclare an already defined function.

Mehrdad Afshari
+6  A: 

: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.

egorius
+1  A: 

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
Charles Bailey