Christian Brabandt wrote:

> here is a patch, that implements an OptionSet autocommand. This can be 
> used, to execute certain actions when an option is set. The pattern is 
> matched against the long option name, so one can react to specific 
> options. E.g. Checking that the 'backupdir' directory exists and can be 
> created if necessary. It therefore provides the new v:option_new, 
> v:option_old and v:option_type so one can check the old and new value 
> and one can also get the scope of the set command.
> 
> This still needs some work and I am also have to write some test for it, 
> but I figured I ask, whether this feature would be interesting enough to 
> be included, before I proceed with some more work on it.
> 
> This is also mentioned in the todo list
> ,----
> | 7   Autocommand for when an option is changed.  Match buffer name or 
> | option name?
> `----
> 
> Comments?

Although this can be useful, it can also cause lots of trouble.
Perhaps a big warning in the documentation could be enough?
It should at least mention ":noautocommand" to avoid triggering the
autocommands when it's not wanted.

Some options have a side effect, I suppose the autocommand would only be
triggered after the side effect?

And when I set several options with one :set command, will all the new
values be set before the first autocommand is triggered, or will the
second value be set after the first triggered?

-- 
hundred-and-one symptoms of being an internet addict:
113. You are asked about a bus schedule, you wonder if it is 16 or 32 bits.

 /// 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

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

Raspunde prin e-mail lui