commit 4485e715fb6a47b4461c8adfcfb6b762492416ec
parent 060993e4381d6e22d46917a36c464d6829efb80b
Author: Justin M. Keyes <justinkz@gmail.com>
Date: Sat, 20 Dec 2025 18:31:00 -0500
fix(options): deprecate 'gdefault', 'magic'
Diffstat:
6 files changed, 34 insertions(+), 108 deletions(-)
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
@@ -304,13 +304,20 @@ OPTIONS
• *cpo-<* *:menu-<special>* *:menu-special* *:map-<special>* *:map-special*
`<>` notation is always enabled.
• *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
+• *'gdefault'* boolean (default off) Enables the :substitute "/g"
+ flag by default. See |complex-change|.
+ command 'gdefault' on 'gdefault' off ~
+ :s/// subst. all subst. one
+ :s///g subst. one subst. all
+ :s///gg subst. all subst. one
+ WARNING: Setting this breaks plugins, because "/g"
+ will have the opposite effect. |:s_g|
• *'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed.
• *'langnoremap'* Deprecated alias to 'nolangremap'.
-• 'sessionoptions' Flags "unix", "slash" are ignored and always enabled.
-• *'vi'*
-• 'viewoptions' Flags "unix", "slash" are ignored and always enabled.
-• *'viminfo'* Deprecated alias to 'shada' option.
-• *'viminfofile'* Deprecated alias to 'shadafile' option.
+• *'magic'* *'nomagic'* boolean (default on) Changes the special characters in
+ search |pattern|s.
+ WARNING: Disabling this breaks plugins, because most
+ patterns assume it's on. See also |/\M|.
• *'paste'* *'nopaste'* Just Paste It.™ The 'paste' option is obsolete:
|paste| is handled automatically when you paste text
using your terminal's or GUI's paste feature
@@ -326,6 +333,11 @@ OPTIONS
• 'cindent'
• 'indentexpr'
• 'lisp'
+• 'sessionoptions' Flags "unix", "slash" are ignored and always enabled.
+• *'vi'*
+• 'viewoptions' Flags "unix", "slash" are ignored and always enabled.
+• *'viminfo'* Deprecated alias to 'shada' option.
+• *'viminfofile'* Deprecated alias to 'shadafile' option.
UI EXTENSIONS
• *ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
@@ -3213,23 +3213,6 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
- *'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
-'gdefault' 'gd' boolean (default off)
- global
- When on, the ":substitute" flag 'g' is default on. This means that
- all matches in a line are substituted instead of one. When a 'g' flag
- is given to a ":substitute" command, this will toggle the substitution
- of all or one match. See |complex-change|.
-
- command 'gdefault' on 'gdefault' off ~
- :s/// subst. all subst. one
- :s///g subst. one subst. all
- :s///gg subst. all subst. one
-
- NOTE: Setting this option may break plugins that rely on the default
- behavior of the 'g' flag. This will also make the 'g' flag have the
- opposite effect of that documented in |:s_g|.
-
*'grepformat'* *'gfm'*
'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m")
global or local to buffer |global-local|
@@ -4217,17 +4200,6 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that using the "-u NONE" and "--noplugin" command line arguments
reset this option. |-u| |--noplugin|
- *'magic'* *'nomagic'*
-'magic' boolean (default on)
- global
- Changes the special characters that can be used in search patterns.
- See |pattern|.
- WARNING: Switching this option off most likely breaks plugins! That
- is because many patterns assume it's on and will fail when it's off.
- Only switch it off when working with old Vi scripts. In any other
- situation write patterns that work when 'magic' is on. Include "\M"
- when you want to |/\M|.
-
*'makeef'* *'mef'*
'makeef' 'mef' string (default "")
global
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
@@ -418,9 +418,9 @@ preceded with a backslash to match literally. For example "." matches any
character while "\." matches a dot.
If a character is taken literally or not depends on the 'magic' option and the
-items in the pattern mentioned next. The 'magic' option should always be set,
-but it can be switched off for Vi compatibility. We mention the effect of
-'nomagic' here for completeness, but we recommend against using that.
+items in the pattern mentioned next. The 'magic' option should always be set.
+We mention the effect of 'nomagic' here for completeness, but we recommend
+against using that.
*/\m* */\M*
Use of "\m" makes the pattern after it be interpreted as if 'magic' is set,
ignoring the actual value of the 'magic' option.
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
@@ -732,7 +732,6 @@ Short explanation of each option: *option-list*
'formatoptions' 'fo' how automatic formatting is to be done
'formatprg' 'fp' name of external program used with "gq" command
'fsync' 'fs' whether to invoke fsync() after file write
-'gdefault' 'gd' the ":substitute" flag 'g' is default on
'grepformat' 'gfm' format of 'grepprg' output
'grepprg' 'gp' program to use for ":grep"
'guicursor' 'gcr' GUI: settings for cursor shape and blinking
@@ -784,7 +783,6 @@ Short explanation of each option: *option-list*
'list' show <Tab> and <EOL>
'listchars' 'lcs' characters for displaying in list mode
'loadplugins' 'lpl' load plugin scripts when starting up
-'magic' changes special characters in search patterns
'makeef' 'mef' name of the errorfile for ":make"
'makeencoding' 'menc' encoding of external make/grep commands
'makeprg' 'mp' program to use for the ":make" command
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
@@ -3011,26 +3011,6 @@ vim.o.fs = vim.o.fsync
vim.go.fsync = vim.o.fsync
vim.go.fs = vim.go.fsync
---- When on, the ":substitute" flag 'g' is default on. This means that
---- all matches in a line are substituted instead of one. When a 'g' flag
---- is given to a ":substitute" command, this will toggle the substitution
---- of all or one match. See `complex-change`.
----
---- command 'gdefault' on 'gdefault' off ~
---- :s/// subst. all subst. one
---- :s///g subst. one subst. all
---- :s///gg subst. all subst. one
----
---- NOTE: Setting this option may break plugins that rely on the default
---- behavior of the 'g' flag. This will also make the 'g' flag have the
---- opposite effect of that documented in `:s_g`.
----
---- @type boolean
-vim.o.gdefault = false
-vim.o.gd = vim.o.gdefault
-vim.go.gdefault = vim.o.gdefault
-vim.go.gd = vim.go.gdefault
-
--- Format to recognize for the ":grep" command output.
--- This is a scanf-like string that uses the same format as the
--- 'errorformat' option: see `errorformat`.
@@ -4248,18 +4228,6 @@ vim.o.lpl = vim.o.loadplugins
vim.go.loadplugins = vim.o.loadplugins
vim.go.lpl = vim.go.loadplugins
---- Changes the special characters that can be used in search patterns.
---- See `pattern`.
---- WARNING: Switching this option off most likely breaks plugins! That
---- is because many patterns assume it's on and will fail when it's off.
---- Only switch it off when working with old Vi scripts. In any other
---- situation write patterns that work when 'magic' is on. Include "\M"
---- when you want to `/\M`.
----
---- @type boolean
-vim.o.magic = true
-vim.go.magic = vim.o.magic
-
--- Name of the errorfile for the `:make` command (see `:make_makeprg`)
--- and the `:grep` command.
--- When it is empty, an internally generated temp file will be used.
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
@@ -1473,7 +1473,7 @@ local options = {
defaults = false,
full_name = 'compatible',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
immutable = true,
},
@@ -2640,7 +2640,7 @@ local options = {
defaults = false,
full_name = 'edcompatible',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
immutable = true,
},
@@ -3826,24 +3826,9 @@ local options = {
{
abbreviation = 'gd',
defaults = false,
- desc = [=[
- When on, the ":substitute" flag 'g' is default on. This means that
- all matches in a line are substituted instead of one. When a 'g' flag
- is given to a ":substitute" command, this will toggle the substitution
- of all or one match. See |complex-change|.
-
- command 'gdefault' on 'gdefault' off ~
- :s/// subst. all subst. one
- :s///g subst. one subst. all
- :s///gg subst. all subst. one
-
- NOTE: Setting this option may break plugins that rely on the default
- behavior of the 'g' flag. This will also make the 'g' flag have the
- opposite effect of that documented in |:s_g|.
- ]=],
full_name = 'gdefault',
scope = { 'global' },
- short_desc = N_('the ":substitute" flag \'g\' is default on'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
varname = 'p_gd',
},
@@ -4388,7 +4373,7 @@ local options = {
defaults = false,
full_name = 'hkmap',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
immutable = true,
},
@@ -4397,7 +4382,7 @@ local options = {
defaults = false,
full_name = 'hkmapp',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
immutable = true,
},
@@ -4796,7 +4781,7 @@ local options = {
defaults = false,
full_name = 'insertmode',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
immutable = true,
},
@@ -5187,7 +5172,7 @@ local options = {
]=],
full_name = 'langremap',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
varname = 'p_lrm',
},
@@ -5527,18 +5512,9 @@ local options = {
},
{
defaults = true,
- desc = [=[
- Changes the special characters that can be used in search patterns.
- See |pattern|.
- WARNING: Switching this option off most likely breaks plugins! That
- is because many patterns assume it's on and will fail when it's off.
- Only switch it off when working with old Vi scripts. In any other
- situation write patterns that work when 'magic' is on. Include "\M"
- when you want to |/\M|.
- ]=],
full_name = 'magic',
scope = { 'global' },
- short_desc = N_('special characters in search patterns'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
varname = 'p_magic',
},
@@ -6450,7 +6426,7 @@ local options = {
full_name = 'paste',
pri_mkrc = true,
scope = { 'global' },
- short_desc = N_('pasting text'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
varname = 'p_paste',
},
@@ -6459,7 +6435,7 @@ local options = {
defaults = '',
full_name = 'pastetoggle',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'string',
immutable = true,
},
@@ -6927,7 +6903,7 @@ local options = {
defaults = true,
full_name = 'remap',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
immutable = true,
},
@@ -7324,7 +7300,7 @@ local options = {
full_name = 'secure',
scope = { 'global' },
secure = true,
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
varname = 'p_secure',
},
@@ -9540,7 +9516,7 @@ local options = {
defaults = false,
full_name = 'terse',
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
immutable = true,
},
@@ -9791,7 +9767,7 @@ local options = {
full_name = 'ttyfast',
no_mkrc = true,
scope = { 'global' },
- short_desc = N_('No description'),
+ short_desc = N_('Deprecated'),
type = 'boolean',
immutable = true,
},