diff runtime/doc/autocmd.txt @ 6935:4db70c94226b v7.4.786

patch 7.4.786 Problem: It is not possible for a plugin to adjust to a changed setting. Solution: Add the OptionSet autocommand event. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Fri, 17 Jul 2015 17:38:22 +0200
parents 2def7b25de60
children b2673982c625
line wrap: on
line diff
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -259,6 +259,7 @@ Name			triggered by ~
 |Syntax|		when the 'syntax' option has been set
 |EncodingChanged|	after the 'encoding' option has been changed
 |TermChanged|		after the value of 'term' has changed
+|OptionSet|		after setting any option
 
 	Startup and exit
 |VimEnter|		after doing all the startup stuff
@@ -744,6 +745,27 @@ MenuPopup			Just before showing the popu
 					o	Operator-pending
 					i	Insert
 					c	Command line
+							*OptionSet*
+OptionSet			After setting an option.  The pattern is
+				matched against the long option name.
+				The |v:option_old| variable indicates the
+				old option value, |v:option_new| variable
+				indicates the newly set value, the
+				|v:option_type| variable indicates whether
+				it's global or local scoped and |<amatch>|
+				indicates what option has been set.
+
+				Is not triggered on startup and for the 'key'
+				option for obvious reasons.
+
+				Note: It's a bad idea, to reset an option
+				during this autocommand, since this will
+				probably break plugins. You can always use
+				|noa| to prevent triggering this autocommand.
+				Could be used, to check for existence of the
+				'backupdir' and 'undodir' options and create
+				directories, if they don't exist yet.
+
 							*QuickFixCmdPre*
 QuickFixCmdPre			Before a quickfix command is run (|:make|,
 				|:lmake|, |:grep|, |:lgrep|, |:grepadd|,