diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-06-15 17:12:48 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-06-15 17:12:48 +0200 |
commit | d7c968794710f338d491072171df48f96612cf72 (patch) | |
tree | d5edca7e09283ff5c345d8e113a10829a70412a2 /runtime/doc/autocmd.txt | |
parent | bffc50494d52a3690cbbc5c7b34a835f9153184e (diff) | |
download | vim-git-d7c968794710f338d491072171df48f96612cf72.tar.gz |
patch 8.1.1542: an OptionSet autocommand does not get enough infov8.1.1542
Problem: An OptionSet autocommand does not get enough info.
Solution: Add v:option_command, v:option_oldlocal and v:option_oldglobal.
(Latrice Wilgus, closes #4118)
Diffstat (limited to 'runtime/doc/autocmd.txt')
-rw-r--r-- | runtime/doc/autocmd.txt | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index c82669514..c922df18a 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 8.1. Last change: 2019 Jun 02 +*autocmd.txt* For Vim version 8.1. Last change: 2019 Jun 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -873,15 +873,33 @@ MenuPopup Just before showing the popup menu (under the *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. + |<amatch>| indicates what option has been set. + + |v:option_type| indicates whether it's global + or local scoped + |v:option_command| indicates what type of + set/let command was used (follow the tag to + see the table). + |v:option_new| indicates the newly set value. + |v:option_oldlocal| hass the old local value. + |v:option_oldglobal| hass the old global + value + |v:option_old| indicates the old option value. + + |v:option_oldlocal| is only set when |:set| + or |:setlocal| or a |modeline| was used to set + the option. Similarly |v:option_oldglobal| is + only set when |:set| or |:setglobal| was used. + + Note that when setting a |global-local| string + option with |:set|, then |v:option_old| is the + old global value. However, for all other kinds + of options (local string options, global-local + number options, ...) it is the old local + value. + + OptionSet is not triggered on startup and for + the 'key' option for obvious reasons. Usage example: Check for the existence of the directory in the 'backupdir' and 'undodir' |