fix(options): deprecate 'gdefault', 'magic'

This commit is contained in:
Justin M. Keyes
2025-12-20 18:31:00 -05:00
parent 060993e438
commit 4485e715fb
6 changed files with 34 additions and 108 deletions

View File

@@ -304,13 +304,20 @@ OPTIONS
• *cpo-<* *:menu-<special>* *:menu-special* *:map-<special>* *:map-special* • *cpo-<* *:menu-<special>* *:menu-special* *:map-<special>* *:map-special*
`<>` notation is always enabled. `<>` notation is always enabled.
• *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. • *'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. • *'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed.
• *'langnoremap'* Deprecated alias to 'nolangremap'. • *'langnoremap'* Deprecated alias to 'nolangremap'.
'sessionoptions' Flags "unix", "slash" are ignored and always enabled. *'magic'* *'nomagic'* boolean (default on) Changes the special characters in
• *'vi'* search |pattern|s.
• 'viewoptions' Flags "unix", "slash" are ignored and always enabled. WARNING: Disabling this breaks plugins, because most
• *'viminfo'* Deprecated alias to 'shada' option. patterns assume it's on. See also |/\M|.
• *'viminfofile'* Deprecated alias to 'shadafile' option.
• *'paste'* *'nopaste'* Just Paste It.™ The 'paste' option is obsolete: • *'paste'* *'nopaste'* Just Paste It.™ The 'paste' option is obsolete:
|paste| is handled automatically when you paste text |paste| is handled automatically when you paste text
using your terminal's or GUI's paste feature using your terminal's or GUI's paste feature
@@ -326,6 +333,11 @@ OPTIONS
• 'cindent' • 'cindent'
• 'indentexpr' • 'indentexpr'
• 'lisp' • '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 EXTENSIONS
• *ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled • *ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled

View File

@@ -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 This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons. 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'*
'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m") 'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m")
global or local to buffer |global-local| 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 Note that using the "-u NONE" and "--noplugin" command line arguments
reset this option. |-u| |--noplugin| 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'*
'makeef' 'mef' string (default "") 'makeef' 'mef' string (default "")
global global

View File

@@ -418,9 +418,9 @@ preceded with a backslash to match literally. For example "." matches any
character while "\." matches a dot. character while "\." matches a dot.
If a character is taken literally or not depends on the 'magic' option and the 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, 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 We mention the effect of 'nomagic' here for completeness, but we recommend
'nomagic' here for completeness, but we recommend against using that. against using that.
*/\m* */\M* */\m* */\M*
Use of "\m" makes the pattern after it be interpreted as if 'magic' is set, Use of "\m" makes the pattern after it be interpreted as if 'magic' is set,
ignoring the actual value of the 'magic' option. ignoring the actual value of the 'magic' option.

View File

@@ -732,7 +732,6 @@ Short explanation of each option: *option-list*
'formatoptions' 'fo' how automatic formatting is to be done 'formatoptions' 'fo' how automatic formatting is to be done
'formatprg' 'fp' name of external program used with "gq" command 'formatprg' 'fp' name of external program used with "gq" command
'fsync' 'fs' whether to invoke fsync() after file write 'fsync' 'fs' whether to invoke fsync() after file write
'gdefault' 'gd' the ":substitute" flag 'g' is default on
'grepformat' 'gfm' format of 'grepprg' output 'grepformat' 'gfm' format of 'grepprg' output
'grepprg' 'gp' program to use for ":grep" 'grepprg' 'gp' program to use for ":grep"
'guicursor' 'gcr' GUI: settings for cursor shape and blinking '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> 'list' show <Tab> and <EOL>
'listchars' 'lcs' characters for displaying in list mode 'listchars' 'lcs' characters for displaying in list mode
'loadplugins' 'lpl' load plugin scripts when starting up 'loadplugins' 'lpl' load plugin scripts when starting up
'magic' changes special characters in search patterns
'makeef' 'mef' name of the errorfile for ":make" 'makeef' 'mef' name of the errorfile for ":make"
'makeencoding' 'menc' encoding of external make/grep commands 'makeencoding' 'menc' encoding of external make/grep commands
'makeprg' 'mp' program to use for the ":make" command 'makeprg' 'mp' program to use for the ":make" command

View File

@@ -3011,26 +3011,6 @@ vim.o.fs = vim.o.fsync
vim.go.fsync = vim.o.fsync vim.go.fsync = vim.o.fsync
vim.go.fs = vim.go.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. --- Format to recognize for the ":grep" command output.
--- This is a scanf-like string that uses the same format as the --- This is a scanf-like string that uses the same format as the
--- 'errorformat' option: see `errorformat`. --- 'errorformat' option: see `errorformat`.
@@ -4248,18 +4228,6 @@ vim.o.lpl = vim.o.loadplugins
vim.go.loadplugins = vim.o.loadplugins vim.go.loadplugins = vim.o.loadplugins
vim.go.lpl = vim.go.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`) --- Name of the errorfile for the `:make` command (see `:make_makeprg`)
--- and the `:grep` command. --- and the `:grep` command.
--- When it is empty, an internally generated temp file will be used. --- When it is empty, an internally generated temp file will be used.

View File

@@ -1473,7 +1473,7 @@ local options = {
defaults = false, defaults = false,
full_name = 'compatible', full_name = 'compatible',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
immutable = true, immutable = true,
}, },
@@ -2640,7 +2640,7 @@ local options = {
defaults = false, defaults = false,
full_name = 'edcompatible', full_name = 'edcompatible',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
immutable = true, immutable = true,
}, },
@@ -3826,24 +3826,9 @@ local options = {
{ {
abbreviation = 'gd', abbreviation = 'gd',
defaults = false, 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', full_name = 'gdefault',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('the ":substitute" flag \'g\' is default on'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
varname = 'p_gd', varname = 'p_gd',
}, },
@@ -4388,7 +4373,7 @@ local options = {
defaults = false, defaults = false,
full_name = 'hkmap', full_name = 'hkmap',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
immutable = true, immutable = true,
}, },
@@ -4397,7 +4382,7 @@ local options = {
defaults = false, defaults = false,
full_name = 'hkmapp', full_name = 'hkmapp',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
immutable = true, immutable = true,
}, },
@@ -4796,7 +4781,7 @@ local options = {
defaults = false, defaults = false,
full_name = 'insertmode', full_name = 'insertmode',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
immutable = true, immutable = true,
}, },
@@ -5187,7 +5172,7 @@ local options = {
]=], ]=],
full_name = 'langremap', full_name = 'langremap',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
varname = 'p_lrm', varname = 'p_lrm',
}, },
@@ -5527,18 +5512,9 @@ local options = {
}, },
{ {
defaults = true, 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', full_name = 'magic',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('special characters in search patterns'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
varname = 'p_magic', varname = 'p_magic',
}, },
@@ -6450,7 +6426,7 @@ local options = {
full_name = 'paste', full_name = 'paste',
pri_mkrc = true, pri_mkrc = true,
scope = { 'global' }, scope = { 'global' },
short_desc = N_('pasting text'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
varname = 'p_paste', varname = 'p_paste',
}, },
@@ -6459,7 +6435,7 @@ local options = {
defaults = '', defaults = '',
full_name = 'pastetoggle', full_name = 'pastetoggle',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'string', type = 'string',
immutable = true, immutable = true,
}, },
@@ -6927,7 +6903,7 @@ local options = {
defaults = true, defaults = true,
full_name = 'remap', full_name = 'remap',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
immutable = true, immutable = true,
}, },
@@ -7324,7 +7300,7 @@ local options = {
full_name = 'secure', full_name = 'secure',
scope = { 'global' }, scope = { 'global' },
secure = true, secure = true,
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
varname = 'p_secure', varname = 'p_secure',
}, },
@@ -9540,7 +9516,7 @@ local options = {
defaults = false, defaults = false,
full_name = 'terse', full_name = 'terse',
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
immutable = true, immutable = true,
}, },
@@ -9791,7 +9767,7 @@ local options = {
full_name = 'ttyfast', full_name = 'ttyfast',
no_mkrc = true, no_mkrc = true,
scope = { 'global' }, scope = { 'global' },
short_desc = N_('No description'), short_desc = N_('Deprecated'),
type = 'boolean', type = 'boolean',
immutable = true, immutable = true,
}, },