Tuesday, January 20, 2015

Re: why "function!" instead of just "function"

> On 2015-01-19 20:31, Bao Niu wrote:
> "function!" vs. "function"?

On Tuesday, January 20, 2015 at 5:49:55 PM UTC+13, Tim Chase replied:
> If a function already exists with the same name as you want to
> create, the "!" will tell it to overwrite the previously-existing
> function.

I'll add that many vim commands work like that, going back to the original vi, where f.ex.

:w! foo.txt

overwrites any existing foo.txt. However, for some commands an added ! indicates an alternate behaviour without any "overwrite any existing" or "really do it" connotation. Blame the original vi, if you like, f.ex. :map! specifies mappings in insert mode.

Regards, John Little

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: