aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/options.lua
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2024-11-04 19:00:12 +0600
committerGitHub <noreply@github.com>2024-11-04 05:00:12 -0800
commita27419f3fc540f66567f4559a796cd6758f1bb1f (patch)
treeff8d1f00c01bb391facba5d239a58eb5aa07eb44 /src/nvim/options.lua
parent04d178053fee7be92c8a7634a1acfe373c758638 (diff)
downloadrneovim-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 'src/nvim/options.lua')
-rw-r--r--src/nvim/options.lua37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 3c21436c3a..71f04a4dde 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -13,7 +13,7 @@
--- @field list? 'comma'|'onecomma'|'commacolon'|'onecommacolon'|'flags'|'flagscomma'
--- @field scope vim.option_scope[]
--- @field deny_duplicates? boolean
---- @field enable_if? string|false
+--- @field enable_if? string
--- @field defaults? vim.option_defaults
--- @field secure? true
--- @field noglob? true
@@ -87,11 +87,11 @@ return {
{
abbreviation = 'al',
defaults = { if_true = 224 },
- enable_if = false,
full_name = 'aleph',
scope = { 'global' },
short_desc = N_('ASCII code of the letter Aleph (Hebrew)'),
type = 'number',
+ immutable = true,
},
{
abbreviation = 'ari',
@@ -789,11 +789,11 @@ return {
current Use the current directory.
{path} Use the specified directory
]=],
- enable_if = false,
full_name = 'browsedir',
scope = { 'global' },
short_desc = N_('which directory to start browsing in'),
type = 'string',
+ immutable = true,
},
{
abbreviation = 'bh',
@@ -1493,7 +1493,7 @@ return {
cb = 'did_set_completeslash',
defaults = { if_true = '' },
desc = [=[
- 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
@@ -3791,12 +3791,12 @@ return {
try to keep 'lines' and 'columns' the same when adding and
removing GUI components.
]=],
- enable_if = false,
full_name = 'guioptions',
list = 'flags',
scope = { 'global' },
short_desc = N_('GUI: Which components and options are used'),
type = 'string',
+ immutable = true,
},
{
abbreviation = 'gtl',
@@ -3816,13 +3816,13 @@ return {
present in 'guioptions'. For the non-GUI tab pages line 'tabline' is
used.
]=],
- enable_if = false,
full_name = 'guitablabel',
modelineexpr = true,
redraw = { 'current_window' },
scope = { 'global' },
short_desc = N_('GUI: custom label for a tab page'),
type = 'string',
+ immutable = true,
},
{
abbreviation = 'gtt',
@@ -3835,12 +3835,12 @@ return {
let &guitabtooltip = "line one\nline two"
<
]=],
- enable_if = false,
full_name = 'guitabtooltip',
redraw = { 'current_window' },
scope = { 'global' },
short_desc = N_('GUI: custom tooltip for a tab page'),
type = 'string',
+ immutable = true,
},
{
abbreviation = 'hf',
@@ -4082,11 +4082,11 @@ return {
English characters directly, e.g., when it's used to type accented
characters with dead keys.
]=],
- enable_if = false,
full_name = 'imcmdline',
scope = { 'global' },
short_desc = N_('use IM when starting to edit a command line'),
type = 'boolean',
+ immutable = true,
},
{
abbreviation = 'imd',
@@ -4100,11 +4100,11 @@ return {
Currently this option is on by default for SGI/IRIX machines. This
may change in later releases.
]=],
- enable_if = false,
full_name = 'imdisable',
scope = { 'global' },
short_desc = N_('do not use the IM in any mode'),
type = 'boolean',
+ immutable = true,
},
{
abbreviation = 'imi',
@@ -5236,7 +5236,7 @@ return {
scope = { 'global' },
short_desc = N_('maximum nr of combining characters displayed'),
type = 'number',
- hidden = true,
+ varname = 'p_mco',
},
{
abbreviation = 'mfd',
@@ -5732,13 +5732,13 @@ return {
indicate no input when the hit-enter prompt is displayed (since
clicking the mouse has no effect in this state.)
]=],
- enable_if = false,
full_name = 'mouseshape',
list = 'onecomma',
scope = { 'global' },
short_desc = N_('shape of the mouse pointer in different modes'),
tags = { 'E547' },
type = 'string',
+ immutable = true,
},
{
abbreviation = 'mouset',
@@ -5898,11 +5898,11 @@ return {
Note that on Windows editing "aux.h", "lpt1.txt" and the like also
result in editing a device.
]=],
- enable_if = false,
full_name = 'opendevice',
scope = { 'global' },
short_desc = N_('allow reading/writing devices on MS-Windows'),
type = 'boolean',
+ immutable = true,
},
{
abbreviation = 'opfunc',
@@ -5975,11 +5975,11 @@ return {
{
abbreviation = 'pt',
defaults = { if_true = '' },
- enable_if = false,
full_name = 'pastetoggle',
scope = { 'global' },
short_desc = N_('No description'),
type = 'string',
+ immutable = true,
},
{
abbreviation = 'pex',
@@ -7270,9 +7270,14 @@ return {
{
abbreviation = 'ssl',
cb = 'did_set_shellslash',
- defaults = { if_true = false },
+ defaults = {
+ condition = 'MSWIN',
+ if_true = false,
+ if_false = true,
+ doc = 'on, Windows: off',
+ },
desc = [=[
- 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
@@ -8885,11 +8890,11 @@ return {
{
abbreviation = 'tenc',
defaults = { if_true = '' },
- enable_if = false,
full_name = 'termencoding',
scope = { 'global' },
short_desc = N_('Terminal encoding'),
type = 'string',
+ immutable = true,
},
{
abbreviation = 'tgc',