ZyX wrote:

> Note about #ifdef FEAT_EVAL in src/option.c: this is for making it
> possible to use :map <defaults> in the future (when I find a way to do
> so): resetting options to default values when mapping is run.
> 
> # HG changeset patch
> # User ZyX <[email protected]>
> # Date 1357992946 -14400
> # Node ID 76ecff419a841f9cb4110274028627d0bd44495e
> # Parent  b89e2bdcc6e516d7e8cbcb3ece9961ffe18b45fa
> Added [defaults] argument to :function
> 
> It serves same purpose as “emulate -L zsh” at the start of zsh
> functions: making function less configuration-dependant.

I like the idea.  But doing this specifically for functions may not be
the best solution.

I'm also not sure if this specific set of options is correct.  We have
the habit of setting 'cpo' to its Vim default in plugins, I wonder if we
really need the others. 'remap' and 'magic' should always be at their
default values.

I think there are two ways to use the functionality:
1. Save the option values and automatically restore them when leaving
   the scope (function, script, or something else)
2. Save the option values in a dict, and restore them when desired.

The second one gives more control, but requires more care from the
script writer.

When these are implemented with a function, you could do the same as
what your patch does and more, right?

-- 
hundred-and-one symptoms of being an internet addict:
257. Your "hundred-and-one" lists include well over 101 items, since you
     automatically interpret all numbers in hexadecimal notation.
     (hex 101 = decimal 257)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui