diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-12-26 12:07:30 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-26 12:07:30 +0000 |
commit | 71eb3ad5790ef3d16369e2fceb040980d75539cf (patch) | |
tree | c24a97c4c6a2de224fcebafd5cc9a34b205e9748 /runtime | |
parent | 8bb65f230d3025037f34021a72616038da0601ee (diff) |
patch 8.2.3901: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 scriptv8.2.3901
Problem: Vim9: Cannot set 'cpo' in main .vimrc if using Vim9 script.
Solution: Do not restore 'cpo' at the end of the main .vimrc.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/options.txt | 10 | ||||
-rw-r--r-- | runtime/doc/vim9.txt | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index f0939e61bb..e8773d9275 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2133,8 +2133,18 @@ A jump table for the options with a short description can be found at |Q_op|. Commas can be added for readability. To avoid problems with flags that are added in the future, use the "+=" and "-=" feature of ":set" |add-option-flags|. + NOTE: This option is set to the Vi default value when 'compatible' is set and to the Vim default value when 'compatible' is reset. + + NOTE: In a |Vim9| script, when `vim9script` is encountered, the value + is saved, 'cpoptions' is set to the Vim default, and the saved value + is restored at the end of the script. Changes to the value of + 'cpoptions' will be applied to the saved value, but keep in mind that + removing a flag that is not present when 'cpoptions' is changed has no + effect. In the |.vimrc| file the value is not restored, thus using + `vim9script` in the |.vimrc| file results in using the Vim default. + NOTE: This option is set to the POSIX default value at startup when the Vi default value would be used and the $VIM_POSIX environment variable exists |posix|. This means Vim tries to behave like the diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 6c142a4b12..ced0c7d930 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1402,6 +1402,7 @@ One of the effects is that |line-continuation| is always enabled. The original value of 'cpoptions' is restored at the end of the script, while flags added or removed in the script are also added to or removed from the original value to get the same effect. The order of flags may change. +In the |vimrc| file sourced on startup this does not happen. *vim9-mix* There is one way to use both legacy and Vim9 syntax in one script file: > |