On Mon, 19 Jan 2015 22:50:49 -0600
Tim Chase <v...@tim.thechases.com> wrote:

> On 2015-01-19 20:31, Bao Niu wrote:
> > I am learning Vimscript and I wonder if there is any difference
> > between writing "function!" vs. "function"? What is that
> > exclamation point for here?
> 
> As detailed at
> 
>   :help E123
> 
> If a function already exists with the same name as you want to
> create, the "!" will tell it to overwrite the previously-existing
> function.  Thus, you might have
> 
>   function Hello()
>     echo 'Hello'
>   endfunction
> 
> and then want to change it, so you'd use
> 
>   function! Hello()
>     echoerr 'Hello'
>   endfunction
> 
> to overwrite it.  Because of the behavior, I just use the "!" *every*
> time that I define a function.  That way, I don't have to think about
> whether it already exists or not.
> 
> -tim

Tim,

Thanks for the complete explanation. I always wondered that myself.

SteveT

Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to