mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 04:39:07 +00:00
Merge #37057 docs
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -117,25 +117,21 @@ To remove or override BUFFER-LOCAL defaults, define a |LspAttach| handler: >lua
|
||||
})
|
||||
<
|
||||
==============================================================================
|
||||
COMMANDS *:lsp*
|
||||
COMMANDS *:lsp* *lsp-commands*
|
||||
|
||||
:lsp enable {name}? *:lsp-enable*
|
||||
Enables the given lsp clients. If no names are given, all clients
|
||||
configured with |vim.lsp.config()| with a filetype matching the current
|
||||
buffer's filetype are enabled. Use |vim.lsp.enable()| for non-interactive
|
||||
use.
|
||||
:lsp enable [config_name] *:lsp-enable*
|
||||
Activates LSP for current and future buffers. See |vim.lsp.enable()|.
|
||||
|
||||
:lsp disable {name}? *:lsp-disable*
|
||||
Disables (and stops) the given lsp clients. If no names are given,
|
||||
all clients attached to the current buffer are disabled. Use
|
||||
|vim.lsp.enable()| with `enable=false` for non-interactive use.
|
||||
:lsp disable [config_name] *:lsp-disable*
|
||||
Disables (and stops) LSP for current and future buffers. See
|
||||
|vim.lsp.enable()|.
|
||||
|
||||
:lsp restart {client}? *:lsp-restart*
|
||||
Restarts the given lsp clients. If no client names are given, all active
|
||||
:lsp restart [client_name] *:lsp-restart*
|
||||
Restarts LSP clients and servers. If no client names are given, all active
|
||||
clients attached to the current buffer are restarted.
|
||||
|
||||
:lsp stop {client}? *:lsp-stop*
|
||||
Stops the given lsp clients. If no client names are given, all active
|
||||
:lsp stop [client_name] *:lsp-stop*
|
||||
Stops LSP clients and servers. If no client names are given, all active
|
||||
clients attached to the current buffer are stopped. Use |Client:stop()|
|
||||
for non-interactive use.
|
||||
|
||||
|
||||
@@ -241,6 +241,7 @@ HIGHLIGHTS
|
||||
|
||||
LSP
|
||||
|
||||
• |:lsp| can be used to interactively manage LSP clients.
|
||||
• |vim.lsp.ClientConfig| gained `workspace_required`.
|
||||
• You can control the priority of |vim.lsp.Config| `root_markers`.
|
||||
• Support for `textDocument/documentColor`: |lsp-document_color|
|
||||
@@ -280,19 +281,17 @@ LSP
|
||||
• Support for `textDocument/onTypeFormatting`: |lsp-on_type_formatting|
|
||||
https://microsoft.github.io/language-server-protocol/specification/#textDocument_onTypeFormatting
|
||||
• The filter option of |vim.lsp.buf.code_action()| now receives the client ID as an argument.
|
||||
• |Client:stop()| and |vim.lsp.enable()| accept `force` as an integer, which is
|
||||
treated as the time to wait before before "stop" escalates to "force-stop".
|
||||
• |vim.lsp.ClientConfig| `exit_timeout` decides the time waited before "stop"
|
||||
escalates to "force-stop" for |vim.lsp.enable()|, |Client:stop()|, and
|
||||
during Nvim shutdown.
|
||||
• `exit_timeout` graduated from "experimental" `flags.exit_timeout`
|
||||
to a top-level field. Defaults to `false`.
|
||||
• |Client:stop()| accepts `force` as an integer, which is treated as the time
|
||||
to wait before before stop escalates to force-stop.
|
||||
• Add cmp field to opts of |vim.lsp.completion.enable()| for custom completion ordering.
|
||||
• Support for `workspace/diagnostic/refresh`:
|
||||
https://microsoft.github.io/language-server-protocol/specification/#diagnostic_refresh
|
||||
- Support for dynamic registration for `textDocument/diagnostic`
|
||||
• |:lsp| for interactively enabling, disabling, restarting, and stopping lsp
|
||||
clients.
|
||||
• Support for dynamic registration for `textDocument/diagnostic`
|
||||
|
||||
LUA
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
32
runtime/lua/vim/_meta/options.lua
generated
32
runtime/lua/vim/_meta/options.lua
generated
@@ -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.
|
||||
|
||||
@@ -308,7 +308,7 @@ void check_pos(buf_T *buf, pos_T *pos)
|
||||
}
|
||||
}
|
||||
|
||||
/// Make sure curwin->w_cursor.lnum is valid.
|
||||
/// Make sure win->w_cursor.lnum is valid.
|
||||
void check_cursor_lnum(win_T *win)
|
||||
{
|
||||
buf_T *buf = win->w_buffer;
|
||||
|
||||
@@ -2934,7 +2934,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
int win_normal_bg = normal_bg;
|
||||
int win_normal_cterm_bg = cterm_normal_bg_color;
|
||||
|
||||
// Get window-local Normal background (respects winhighlight)
|
||||
// Get window-local Normal background (respects 'winhighlight' option).
|
||||
if (bg_attr != 0) {
|
||||
HlAttrs norm_ae = syn_attr2entry(bg_attr);
|
||||
win_normal_bg = norm_ae.rgb_bg_color;
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -22,6 +22,18 @@ describe(':lsp', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
it('fails if runtime is missing/broken', function()
|
||||
clear {
|
||||
args_rm = { '-u' },
|
||||
args = { '-u', 'NONE' },
|
||||
env = { VIMRUNTIME = 'non-existent' },
|
||||
}
|
||||
eq(
|
||||
[[Vim(lsp):Lua: [string "<nvim>"]:0: module 'vim._core.ex_cmd.lsp' not found:]],
|
||||
vim.split(t.pcall_err(n.command, 'lsp enable dummy'), '\n')[1]
|
||||
)
|
||||
end)
|
||||
|
||||
for _, test_with_arguments in ipairs({ true, false }) do
|
||||
local test_message_suffix, lsp_command_suffix
|
||||
if test_with_arguments then
|
||||
@@ -114,16 +126,4 @@ describe(':lsp', function()
|
||||
end)
|
||||
eq(2, cmd_length)
|
||||
end)
|
||||
|
||||
it('fail with no runtime without crashing', function()
|
||||
clear {
|
||||
args_rm = { '-u' },
|
||||
args = { '-u', 'NONE' },
|
||||
env = { VIMRUNTIME = 'non-existent' },
|
||||
}
|
||||
eq(
|
||||
[[Vim(lsp):Lua: [string "<nvim>"]:0: module 'vim._core.ex_cmd.lsp' not found:]],
|
||||
vim.split(t.pcall_err(n.command, 'lsp enable dummy'), '\n')[1]
|
||||
)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user