diff options
author | Famiu Haque <famiuhaque@proton.me> | 2024-11-04 19:00:12 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-04 05:00:12 -0800 |
commit | a27419f3fc540f66567f4559a796cd6758f1bb1f (patch) | |
tree | ff8d1f00c01bb391facba5d239a58eb5aa07eb44 /runtime | |
parent | 04d178053fee7be92c8a7634a1acfe373c758638 (diff) | |
download | rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.tar.gz rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.tar.bz2 rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.zip |
feat(options)!: disallow setting hidden options #28400
Problem:
There are three different ways of marking an option as hidden, `enable_if
= false`, `hidden = true` and `immutable = true`. These also have different
behaviors. Options hidden with `enable_if = false` can't have their value
fetched using Vim script or the API, but options hidden with `hidden = true` or
`immutable = true` can. On the other hand, options with `hidden = true` do not
error when trying to set their value, but options with `immutable = true` do.
Solution:
Remove `enable_if = false`, remove the `hidden` property for options, and use
`immutable = true` to mark an option as hidden instead. Also make hidden option
variable pointers always point to the default value, which allows fetching the
value of every hidden option using Vim script and the API. This does also mean
that trying to set a hidden option will now give an error instead of just being
ignored.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/zip.vim | 4 | ||||
-rw-r--r-- | runtime/doc/news.txt | 2 | ||||
-rw-r--r-- | runtime/doc/options.txt | 15 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/options.lua | 6 |
4 files changed, 16 insertions, 11 deletions
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index 172de98d36..a8ea6a3fab 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -408,7 +408,9 @@ fun! s:SetSaneOpts() let dict.shellslash = &shellslash let &report = 10 - let &shellslash = 0 + if exists('+shellslash') + let &shellslash = 0 + endif return dict endfun diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 3ed1442a96..3a8277f566 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -113,6 +113,8 @@ OPTIONS of just string |global-local| options. • `:setlocal {option}<` copies the global value to the local value for number and boolean |global-local| options instead of removing the local value. +• Setting |hidden-options| now gives an error. In particular, setting + 'noshellslash' is now only allowed on Windows. PLUGINS diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 8877054b77..3217f5c565 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -642,11 +642,12 @@ Hidden options *hidden-options* Not all options are supported in all versions. This depends on the supported features and sometimes on the system. A remark about this is in curly braces -below. When an option is not supported it may still be set without getting an -error, this is called a hidden option. You can't get the value of a hidden -option though, it is not stored. +below. When an option is not supported, it is called a hidden option. Trying +to get the value of a hidden option will not give an error, it will return the +default value for that option instead. You can't change the value of a hidden +option. -To test if option "foo" can be used with ":set" use something like this: > +To test if "foo" is a valid option name, use something like this: > if exists('&foo') This also returns true for a hidden option. To test if option "foo" is really supported use something like this: > @@ -1573,7 +1574,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'completeslash'* *'csl'* 'completeslash' 'csl' string (default "") local to buffer - only for MS-Windows + only modifiable in MS-Windows When this option is set it overrules 'shellslash' for completion: - When this option is set to "slash", a forward slash is used for path completion in insert mode. This is useful when editing HTML tag, or @@ -5277,9 +5278,9 @@ A jump table for the options with a short description can be found at |Q_op|. security reasons. *'shellslash'* *'ssl'* *'noshellslash'* *'nossl'* -'shellslash' 'ssl' boolean (default off) +'shellslash' 'ssl' boolean (default on, Windows: off) global - only for MS-Windows + only modifiable in MS-Windows When set, a forward slash is used when expanding file names. This is useful when a Unix-like shell is used instead of cmd.exe. Backward slashes can still be typed, but they are changed to forward slashes by diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index f9886957a7..45ab14a774 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -1106,7 +1106,7 @@ vim.bo.cot = vim.bo.completeopt vim.go.completeopt = vim.o.completeopt vim.go.cot = vim.go.completeopt ---- only for MS-Windows +--- only modifiable in MS-Windows --- When this option is set it overrules 'shellslash' for completion: --- - When this option is set to "slash", a forward slash is used for path --- completion in insert mode. This is useful when editing HTML tag, or @@ -5547,7 +5547,7 @@ vim.o.srr = vim.o.shellredir vim.go.shellredir = vim.o.shellredir vim.go.srr = vim.go.shellredir ---- only for MS-Windows +--- only modifiable in MS-Windows --- When set, a forward slash is used when expanding file names. This is --- useful when a Unix-like shell is used instead of cmd.exe. Backward --- slashes can still be typed, but they are changed to forward slashes by @@ -5564,7 +5564,7 @@ vim.go.srr = vim.go.shellredir --- Also see 'completeslash'. --- --- @type boolean -vim.o.shellslash = false +vim.o.shellslash = true vim.o.ssl = vim.o.shellslash vim.go.shellslash = vim.o.shellslash vim.go.ssl = vim.go.shellslash |