diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 5fb51ed7fa..01771be7c0 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1573,6 +1573,8 @@ nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()* exists. • link: Name of highlight group to link to. |:hi-link| • sp: color name or "#RRGGBB" + • update: boolean (default false) Update specified attributes + only, leave others unchanged. • altfont: boolean • blink: boolean • bold: boolean @@ -1590,8 +1592,6 @@ nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()* • underdotted: boolean • underdouble: boolean • underline: boolean - • update: boolean false by default; true updates only - specified attributes, leaving others unchanged. nvim_set_hl_ns({ns_id}) *nvim_set_hl_ns()* Set active namespace for highlights defined with |nvim_set_hl()|. This can diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 85fb2176f4..fec542f9ce 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -17,12 +17,12 @@ DEPRECATED IN 0.12 *deprecated-0.12* API -• todo +• nvim_set_decoration_provider `on_line` Use `on_range` instead. DIAGNOSTICS -• "float" in |vim.diagnostic.JumpOpts|. Use "on_jump" instead. -• "float" in |vim.diagnostic.Opts.Jump|. Use "on_jump" instead. +• "float" in |vim.diagnostic.JumpOpts|. Use `on_jump` instead. +• "float" in |vim.diagnostic.Opts.Jump|. Use `on_jump` instead. HIGHLIGHTS @@ -58,10 +58,6 @@ UI • *hit-enter* *hit-enter-prompt* With |ui2|, the legacy "Press ENTER" *press-enter prompt is never triggered. -VIMSCRIPT - -• todo - ------------------------------------------------------------------------------ DEPRECATED IN 0.11 *deprecated-0.11* diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 1beffaca48..024c9433a1 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2096,8 +2096,8 @@ vim.tbl_filter({fn}, {t}) *vim.tbl_filter()* (`any[]`) Table of filtered values vim.tbl_get({o}, {...}) *vim.tbl_get()* - Index into a table (first argument) via string keys passed as subsequent - arguments. Return `nil` if the key does not exist. + Gets a value from (nested) table `o` given by the sequence of keys `...`, + or `nil` if not found. Examples: >lua vim.tbl_get({ key = { nested_key = true }}, 'key', 'nested_key') == true @@ -2246,7 +2246,8 @@ vim.validate({name}, {value}, {validator}, {optional}, {message}) `'userdata'`. • (`fun(val:any): boolean, string?`) A function that returns a boolean and an optional string message. - • {optional} (`boolean?`) Argument is optional (may be omitted) + • {optional} (`boolean?`) Parameter is optional (may be omitted or + nil) • {message} (`string?`) message when validation fails Overloads: ~ @@ -2454,6 +2455,13 @@ vim.filetype.match({args}) *vim.filetype.match()* Lua module: vim.fs *vim.fs* + *vim.fs.copy()* +Use |filecopy()| or |uv.fs_copyfile()| to performantly copy an existing file. + +Example: >lua + vim.fn.filecopy('foo.txt', 'bar.txt') +< + *vim.fs.exists()* Use |uv.fs_stat()| to check a file's type, and whether it exists. @@ -3581,9 +3589,10 @@ vim.json.encode({obj}, {opts}) *vim.json.encode()* • {opts} (`table?`) A table with the following fields: • {escape_slash}? (`boolean`, default: `false`) Escape slash characters "/" in string values. - • {indent}? (`string`, default: `""`) If non-empty, the - returned JSON is formatted with newlines and whitespace, - where `indent` defines the whitespace at each nesting level. + • {indent}? (`string`, default: `""`) If non-empty, each value + in a JSON object or array starts on a new line and is + prefixed with `indent` per nesting level. Adds a space after + colons. Does not add a final newline. • {sort_keys}? (`boolean`, default: `false`) Sort object keys in alphabetical order. @@ -5074,16 +5083,13 @@ vim.ui.select({items}, {opts}, {on_choice}) *vim.ui.select()* Example: >lua vim.ui.select({ 'tabs', 'spaces' }, { - prompt = 'Select tabs or spaces:', - format_item = function(item) - return "I'd like to choose " .. item - end, + prompt = 'Select tabs or spaces:', + format_item = function(item) + return ('I choose %s!'):format(item) + end, }, function(choice) - if choice == 'spaces' then - vim.o.expandtab = true - else - vim.o.expandtab = false - end + vim.o.expandtab = choice == 'spaces' + vim.print(('Selected "%s" => expandtab=%s'):format(choice, vim.o.expandtab)) end) < @@ -5461,7 +5467,8 @@ and their respective buffers. Unlike the legacy |hit-enter| prompt, messages exceeding 'cmdheight' are instead "collapsed", followed by a `[+x]` "spill" indicator, where `x` indicates the spilled lines. To see the full messages, do either: -• ENTER while cmdline is expanded (not in |Insert-mode| and |Terminal-mode|). +• ENTER immediately after interactive |:| cmdline shows a message and returns + to |Normal-mode|. • |g<| at any time. vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index cd39186e4a..d05f3f915d 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -10,53 +10,6 @@ For changes in the previous release, see |news-0.11|. Type |gO| to see the table of contents. -============================================================================== -BREAKING CHANGES IN HEAD OR EXPERIMENTAL *news-breaking-dev* - - ====== Remove this section before release. ====== - -The following changes to UNRELEASED features were made during the development -cycle (Nvim HEAD, the "master" branch). - -EVENTS - -• Renamed "nvim.find_exrc" |default-autocmds| group to "nvim.exrc". - -EXPERIMENTS - -• todo - -LUA - -• |vim.net.request()| does not set the response body to `true` if an output - buffer is supplied. - -LSP - -• |vim.lsp.buf.selection_range()| now accepts an integer which specifies its - direction, rather than a string `'outer'` or `'inner'`. - -DIAGNOSTICS - -• |vim.diagnostic.Opts.Status|.text was removed in favour of - |vim.diagnostic.Opts.Status|.format. - -OPTIONS - -• `'completefuzzycollect'` and `'isexpand'` have been removed. - -TREESITTER - -• todo - -UI - -• `progress` attribute removed from |ui-messages| msg_show event - -VIMSCRIPT - -• `complete_match()` has been removed. - ============================================================================== BREAKING CHANGES *news-breaking* @@ -64,20 +17,15 @@ These changes may require adaptations in your config or plugins. API -• Decoration provider has `on_range()` callback. • |nvim_get_commands()| returns `complete` as a Lua function, if it was defined as such. -BUILD - -• todo - DIAGNOSTICS • |diagnostic-signs| can no longer be configured with |:sign-define| or |sign_define()| (deprecated in Nvim 0.10 |deprecated-0.10|). -• |vim.diagnostic.disable()| and |vim.diagnostic.is_disabled()| (deprecated in - Nvim 0.10 |deprecated-0.10|) are removed. +• Removed |vim.diagnostic.disable()| and |vim.diagnostic.is_disabled()| + (deprecated in Nvim 0.10 |deprecated-0.10|). • The legacy signature of |vim.diagnostic.enable()| (deprecated in Nvim 0.10 |deprecated-0.10|) is no longer supported. @@ -86,10 +34,10 @@ EDITOR • |i_CTRL-R| inserts named/clipboard registers (A-Z,a-z,0-9+) literally, like pasting instead of like user input. Improves performance, avoids broken formatting. To get the old behavior you can use `=@x`. -• Buffer name URI scheme parsing more closely follows RFC3986, so for example +• Parsing of URI-like buffer names more closely follows RFC3986, so for example "svn+ssh:", "ed2k:", and "iris.xpc:" are recognized as URI schemes. -• On Windows, Nvim no longer searches the current directory for executables - for running external commands; prefix a relative or absolute path if you +• Security: Nvim on Windows no longer searches the current directory for + external command executables; prefix a relative or absolute path if you want the old behavior |$NoDefaultCurrentDirectoryInExePath|. EVENTS @@ -101,10 +49,6 @@ EVENTS traffic and more flexibility for UIs. The `msg_history_show` event has an additional "prev_cmd" argument. -HIGHLIGHTS - -• todo - LSP • JSON "null" values in LSP messages are represented as |vim.NIL| instead of `nil`. @@ -134,8 +78,7 @@ PLUGINS TREESITTER -• The |vim.treesitter.query.lint()| is no longer enabled by default in the - |ft-query-plugin|. +• |ft-query-plugin| no longer enables |vim.treesitter.query.lint()| by default. • |treesitter-directive-offset!| can now be applied to quantified captures. It no longer sets `metadata[capture_id].range`; it instead sets `metadata[capture_id].offset`. The offset will be applied in @@ -144,14 +87,6 @@ TREESITTER • The "all" option to |Query:iter_matches()|, which was introduced in Nvim 0.11 to aid in transitioning to the new behavior, has been removed. -TUI - -• todo - -VIMSCRIPT - -• todo - ============================================================================== NEW FEATURES *news-features* @@ -176,24 +111,23 @@ API • |nvim_open_win()| floating windows can show a 'statusline'. Plugins can use `style='minimal'` or `:setlocal statusline=` to hide the statusline. • |nvim_win_set_config()| can move |floating-windows| to other tabpages. -• Added experimental |nvim__exec_lua_fast()| to allow remote API clients to - execute code while nvim is blocking for input. +• EXPERIMENTAL: |nvim__exec_lua_fast()| allows remote API clients to execute + Lua while Nvim is blocking for input. |api-fast| +• Decoration provider gained an `on_range` callback (deprecates `on_line`). • |vim.secure.trust()| accepts `path` for the `allow` action. -• |nvim_get_chan_info()| includes `exitcode` field for terminal buffers +• |nvim_get_chan_info()| includes `exitcode` field for :terminal buffers. • |nvim_set_hl()| supports updating specified attributes only. BUILD -• A Zig-based build system has been added as an alternative to CMake. It is +• EXPERIMENTAL: Zig-based build is available as an alternative to CMake. It is currently limited in functionality, and CMake remains the recommended option for the time being. • Nvim can be built without Unibilium (terminfo implementation), in which case the user's terminfo database won't be loaded and only internal definitions for the most common terminals are used: > - - make distclean && make CMAKE_EXTRA_FLAGS="-DENABLE_UNIBILIUM=0" DEPS_CMAKE_FLAGS"-DUSE_BUNDLED_UNIBILIUM=0" -< -• On Windows, `tee.exe` is installed with `nvim.exe` by default so that + make distclean && make CMAKE_EXTRA_FLAGS="-DENABLE_UNIBILIUM=0" DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_UNIBILIUM=0" +• On Windows, `tee.exe` is included with `nvim.exe` by default so that commands like :make, :grep work out of the box. DEFAULTS @@ -201,15 +135,17 @@ DEFAULTS • 'diffopt' default value now includes "indent-heuristic" and "inline:char". • 'statusline' default is exposed as a statusline expression (previously it was implemented as an internal C routine). -• 'statusline' includes |vim.diagnostic.status()| -• 'statusline' shows exit code of finished terminal buffers +• Default 'statusline' shows: + • |vim.diagnostic.status()| + • |vim.ui.progress_status() + • :terminal exit code • Project-local configuration ('exrc') is also loaded from parent directories. Unset 'exrc' to stop further search. • Mappings: • |grt| in Normal mode maps to |vim.lsp.buf.type_definition()| • |grx| in Normal mode maps to |vim.lsp.codelens.run()| • 'shada' default now excludes "/tmp/" and "/private/" paths to reduce clutter in |:oldfiles|. -• Enabled treesitter highlighting for Markdown files +• Enabled treesitter highlighting for Markdown files. DIAGNOSTICS @@ -218,10 +154,10 @@ DIAGNOSTICS location/quickfix list. • |vim.diagnostic.get()| now accepts an `enabled` filter to only return enabled or disabled diagnostics. -• |vim.diagnostic.status()| returns a formatted string with current buffer - diagnostics -• |vim.diagnostic.fromqflist()| now accepts an `opts` table with - `merge_lines` to merge multi-line compiler messages. +• |vim.diagnostic.status()| returns a status description of current buffer + diagnostics. +• |vim.diagnostic.fromqflist()| accepts `opts.merge_lines` to merge multiline + compiler messages. EDITOR @@ -229,7 +165,7 @@ EDITOR • |:retab| accepts new optional parameter -indentonly to only change leading whitespace in indented lines. • |:uniq| deduplicates text in the current buffer. -• |omnicompletion| in `help` buffer. |ft-help-omni| +• |omnicompletion| is available when editing |help| buffers. |ft-help-omni| • |:help!| has DWIM ("Do What I Mean") behavior: it tries to guess the help tag at cursor. In help buffers, 'keywordprg' defaults to ":help!". For example, try "K" anywhere in this code: > @@ -240,20 +176,18 @@ EDITOR commands. • 'wildchar' now enables completion in search contexts using |/|, |?|, |:g|, |:v| and |:vimgrep| commands. -• For security, 'exrc' no longer shows "(a)llow". Instead you must "(v)iew", +• Security: 'exrc' no longer shows "(a)llow". Instead you must "(v)iew", then run `:trust` (or `:trust [file]`, but that has a TOCTOU risk). -• |gx| in help buffers opens the online documentation for the tag under the - cursor. +• |gx| in help buffers opens the online documentation for the tag at cursor. • |:source| with a range in non-Lua files (e.g., vimdoc) now detects Lua codeblocks via treesitter and executes them as Lua instead of Vimscript. -• |:Undotree| for visually navigating the |undo-tree| -• |:wall| permits a |++p| option for creating parent directories when writing - changed buffers. -• The |:DiffTool| command compares directories (and files). + (Or use `:{range}lua` to skip the detection.) +• |:wall| with |++p| auto-creates missing parent directories. EVENTS -• A new `empty` message kind is emitted for an empty (e.g. `:echo ""`) message. +• In the |ui-protocol|, message kind `empty` is emitted for empty messages + (e.g. `:echo ""`). • |CmdlineLeave| sets |v:char| to the character that stops the Cmdline mode. • |CmdlineLeavePre| triggered before preparing to leave the command line. • New `append`, `id` and `trigger` parameter for |ui-messages| `msg_show` event. @@ -263,7 +197,7 @@ EVENTS support implicit marks like |'[| or |'<|, …). • |SessionLoadPre| is triggered before loading a |Session| file. • |TabClosedPre| is triggered before closing a |tabpage|. -• New `terminator` parameter for |TermRequest| event. +• |TermRequest| event gained a `terminator` parameter. HIGHLIGHTS @@ -276,13 +210,41 @@ HIGHLIGHTS LSP +• |lsp-completion|: + • |vim.lsp.completion.enable()| gained a `cmp` option for custom ordering. + • Supports colored symbol preview for color items. + • Shows a preview ("completionItem/resolve") if 'completeopt' has "popup". + • Support for `textDocument/inlineCompletion` |lsp-inline_completion| + https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_inlineCompletion + See |lsp-inline_completion| for quickstart instructions. • |: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| - https://microsoft.github.io/language-server-protocol/specification/#textDocument_documentColor -• Support for `textDocument/colorPresentation |lsp-document_color| - https://microsoft.github.io/language-server-protocol/specification/#textDocument_colorPresentation +• LSP capabilities: + • `textDocument/codeLens` |lsp-codelens| was reimplemented. + https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_codeLens + • `textDocument/colorPresentation` |lsp-document_color| + https://microsoft.github.io/language-server-protocol/specification/#textDocument_colorPresentation + • `textDocument/diagnostic` + • `textDocument/documentColor` |lsp-document_color| + https://microsoft.github.io/language-server-protocol/specification/#textDocument_documentColor + • `textDocument/documentLink`: |gx| opens "documentLink" items at cursor. + • `textDocument/inlineCompletion` + • `textDocument/linkedEditingRange` |lsp-linked_editing_range| + https://microsoft.github.io/language-server-protocol/specification/#textDocument_linkedEditingRange + • `textDocument/onTypeFormatting` |lsp-on_type_formatting| + https://microsoft.github.io/language-server-protocol/specification/#textDocument_onTypeFormatting + • `textDocument/selectionRange` Incremental selection. + |v_an| selects outwards, |v_in| selects inwards. + • `textDocument/semanticTokens/range` + • `workspace/codeLens/refresh` + https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeLens_refresh + • `workspace/diagnostic/refresh` + https://microsoft.github.io/language-server-protocol/specification/#diagnostic_refresh + • `workspace/diagnostic` |vim.lsp.buf.workspace_diagnostics()| + https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_dagnostics +• Support for dynamic registration: + • `textDocument/diagnostic` • The `textDocument/diagnostic` request now includes the previous id in its parameters. • |vim.lsp.enable()| start/stops clients as necessary and detaches @@ -290,10 +252,6 @@ LSP • |vim.lsp.is_enabled()| checks if a LSP config is enabled (without "resolving" it). • |vim.lsp.get_configs()| gets all LSP configs matching an optional filter. -• Support for `workspace/diagnostic`: |vim.lsp.buf.workspace_diagnostics()| - https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_dagnostics -• Incremental selection is now supported via `textDocument/selectionRange`. - `an` selects outwards and `in` selects inwards. • Support for multiline semantic tokens. • Support for the `disabled` field on code actions. • The function form of `cmd` in a vim.lsp.Config or vim.lsp.ClientConfig @@ -306,16 +264,9 @@ LSP • When inside the float created by |vim.diagnostic.open_float()| and the cursor is on a line with `DiagnosticRelatedInformation`, |gf| can be used to jump to the problematic location. -• Support for `textDocument/linkedEditingRange`: |lsp-linked_editing_range| - https://microsoft.github.io/language-server-protocol/specification/#textDocument_linkedEditingRange • Support for related documents in pull diagnostics: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#relatedFullDocumentDiagnosticReport • |vim.lsp.buf.signature_help()| supports "noActiveParameterSupport". -• Support for `textDocument/inlineCompletion` |lsp-inline_completion| - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_inlineCompletion - See |lsp-inline_completion| for quickstart instructions. -• 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. • |vim.lsp.ClientConfig| `exit_timeout` decides the time waited before "stop" escalates to "force-stop" for |vim.lsp.enable()|, |Client:stop()|, and @@ -324,45 +275,30 @@ LSP 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. -• |lsp-completion|: - • |vim.lsp.completion.enable()| gained a `cmp` option for custom ordering. - • Supports colored symbol preview for color items. - • Shows a preview ("completionItem/resolve") if 'completeopt' has "popup". -• Support for `workspace/diagnostic/refresh`: - https://microsoft.github.io/language-server-protocol/specification/#diagnostic_refresh -• Support for dynamic registration for `textDocument/diagnostic` • |vim.lsp.buf.rename()| now highlights the symbol being renamed using the |hl-LspReferenceTarget| highlight group. -• Support for `textDocument/semanticTokens/range`. -• Support for `textDocument/codeLens` |lsp-codelens| has been reimplemented: - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_codeLens • Code lenses now display as virtual lines -• Support for `workspace/codeLens/refresh`: - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeLens_refresh -• |gx| opens `textDocument/documentLink` items found at cursor. LUA -• |vim.net.request()| can fetch files via HTTP GET requests. +• |vim.net.request()| can fetch/download HTTP content. • |vim.wait()| returns the callback results. • Lua type annotations for `vim.uv`. • |vim.hl.range()| now allows multiple timed highlights. -• |vim.tbl_extend()| and |vim.tbl_deep_extend()| now accept a function behavior argument. +• |vim.tbl_extend()|, |vim.tbl_deep_extend()| `behavior` argument can be a function. • |vim.fs.root()| can define "equal priority" via nested lists. -• |vim.version.range()| output can be converted to a human-readable string with |tostring()|. +• |vim.fs.ext()| returns the last extension of a file. +• |vim.version.range()| can output human-readable string via |tostring()|. • |vim.version.intersect()| computes intersection of two version ranges. • |Iter:take()| and |Iter:skip()| now optionally accept predicates. • |Iter:peek()| now works for all iterator types, not just |list-iterator|. -• Built-in plugin manager |vim.pack| • |vim.list.unique()| and |Iter:unique()| to deduplicate lists and iterators, respectively. -• |vim.list.bisect()| for binary search. -• Experimental `vim.pos` and `vim.range` for Position/Range abstraction. -• |vim.json.encode()| has an `indent` option for pretty-formatting. -• |vim.json.encode()| has an `sort_keys` option. -• |Range:is_empty()| to check if a |vim.Range| is empty. -• |vim.json.decode()| has an `skip_comments` option. -• |vim.fs.ext()| returns the last extension of a file. +• |vim.list.bisect()| performs binary search. +• |vim.json.encode()| `indent` option performs pretty-formatting. +• |vim.json.encode()| `sort_keys` option sorts by key. +• |vim.json.decode()| `skip_comments` option allows comments in JSON data. +• EXPERIMENTAL: |vim.pos|, |vim.range| provide Position/Range abstraction. OPTIONS @@ -386,14 +322,14 @@ OPTIONS • 'maxsearchcount' sets maximum value for |searchcount()| and defaults to 999. • 'pummaxwidth' sets maximum width for the completion popup menu. • 'winborder' "bold" style, custom border style. -• |g:clipboard| accepts a string name to force any builtin clipboard tool. • 'busy' sets a buffer "busy" status. Indicated in the default statusline. • 'pumborder' adds a border to the popup menu. -• |g:clipboard| autodetection only selects tmux when running inside tmux. +• |g:clipboard| accepts a string name to force any builtin clipboard tool. +• |g:clipboard| autodetection selects tmux only when running inside tmux. • 'statusline' allows "stacking" highlight groups (groups inherit from previous highlight attributes) -• 'messagesopt' added progress:c to control if progress messages are shown in - cmdline. +• 'messagesopt' "progress:c" flag controls whether progress messages are shown + in the cmdline message area. • Improved |:set+=|, |:set^=| and |:set-=| handling of comma-separated "key:value" pairs (e.g. 'listchars', 'fillchars', 'diffopt'). @@ -414,6 +350,9 @@ PERFORMANCE PLUGINS +• Built-in plugin manager: |vim.pack| +• |:DiffTool| compares directories (and files). +• |:Undotree| lets you visually navigate the |undo-tree|. • Customize :checkhealth by handling a `FileType checkhealth` event. |health-usage| • Simplify Python provider setup to a single step: `uv tool install pynvim` diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 6652d6b595..3b3a16556a 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -75,6 +75,7 @@ Defaults *defaults* *nvim-defaults* - 'nrformats' defaults to "bin,hex" - 'path' defaults to ".,,". The C ftplugin adds "/usr/include" if it exists. - 'sessionoptions' includes "unix,slash", excludes "options" +- 'shelltemp' is disabled - 'shortmess' includes "CF", excludes "S" - 'sidescroll' defaults to 1 - 'smarttab' is enabled diff --git a/runtime/doc/vimfn.txt b/runtime/doc/vimfn.txt index 103e44fbc7..afb253a4f3 100644 --- a/runtime/doc/vimfn.txt +++ b/runtime/doc/vimfn.txt @@ -117,7 +117,7 @@ append({lnum}, {text}) *append()* (`0|1`) appendbufline({buf}, {lnum}, {text}) *appendbufline()* - Like |append()| but append the text in buffer {expr}. + Like |append()| but append the text in buffer {buf}. This function works only for loaded buffers. First call |bufload()| if needed. diff --git a/runtime/doc/vvars.txt b/runtime/doc/vvars.txt index 7f90913449..d598a00414 100644 --- a/runtime/doc/vvars.txt +++ b/runtime/doc/vvars.txt @@ -760,12 +760,14 @@ v:versionlong *v:vim_did_enter* *vim_did_enter-variable* v:vim_did_enter 0 during startup, 1 just before |VimEnter|. + See also |v:vim_did_init|, which is set earlier. Read-only. *v:vim_did_init* *vim_did_init-variable* v:vim_did_init - 0 during initialization, 1 after sourcing |vimrc| and just - before |load-plugins|. + 0 during initialization, 1 after sourcing the user |vimrc|, + just before |load-plugins|. + See also |v:vim_did_enter|, which is set later. Read-only. *v:virtnum* *virtnum-variable* diff --git a/runtime/lua/vim/_core/shared.lua b/runtime/lua/vim/_core/shared.lua index 669e2a75fa..9b0b90984a 100644 --- a/runtime/lua/vim/_core/shared.lua +++ b/runtime/lua/vim/_core/shared.lua @@ -713,8 +713,7 @@ function vim.tbl_add_reverse_lookup(o) return o end ---- Index into a table (first argument) via string keys passed as subsequent arguments. ---- Return `nil` if the key does not exist. +--- Gets a value from (nested) table `o` given by the sequence of keys `...`, or `nil` if not found. --- --- Examples: --- @@ -1223,7 +1222,7 @@ do --- `'thread'`, `'userdata'`. --- - (`fun(val:any): boolean, string?`) A function that returns a boolean and an optional --- string message. - --- @param optional? boolean Argument is optional (may be omitted) + --- @param optional? boolean Parameter is optional (may be omitted or nil) --- @param message? string message when validation fails --- @overload fun(name: string, val: any, validator: vim.validate.Validator, message: string) --- @overload fun(spec: table) diff --git a/runtime/lua/vim/_core/ui2.lua b/runtime/lua/vim/_core/ui2.lua index 804523ba7a..82c9b2ab0c 100644 --- a/runtime/lua/vim/_core/ui2.lua +++ b/runtime/lua/vim/_core/ui2.lua @@ -43,7 +43,7 @@ --- Unlike the legacy |hit-enter| prompt, messages exceeding 'cmdheight' are --- instead "collapsed", followed by a `[+x]` "spill" indicator, where `x` --- indicates the spilled lines. To see the full messages, do either: ---- - ENTER while cmdline is expanded (not in |Insert-mode| and |Terminal-mode|). +--- - ENTER immediately after interactive |:| cmdline shows a message and returns to |Normal-mode|. --- - |g<| at any time. local api = vim.api diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 65d05dac1e..22ff022147 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -2238,6 +2238,7 @@ function vim.api.nvim_set_decoration_provider(ns_id, opts) end --- - force: if true force update the highlight group when it exists. --- - link: Name of highlight group to link to. `:hi-link` --- - sp: color name or "#RRGGBB" +--- - update: boolean (default false) Update specified attributes only, leave others unchanged. --- - altfont: boolean --- - blink: boolean --- - bold: boolean @@ -2254,7 +2255,6 @@ function vim.api.nvim_set_decoration_provider(ns_id, opts) end --- - underdotted: boolean --- - underdouble: boolean --- - underline: boolean ---- - update: boolean false by default; true updates only specified attributes, leaving others unchanged. function vim.api.nvim_set_hl(ns_id, name, val) end --- Set active namespace for highlights defined with `nvim_set_hl()`. This can be set for diff --git a/runtime/lua/vim/_meta/json.lua b/runtime/lua/vim/_meta/json.lua index 321cc44058..6faaa439d1 100644 --- a/runtime/lua/vim/_meta/json.lua +++ b/runtime/lua/vim/_meta/json.lua @@ -25,8 +25,8 @@ vim.json = {} --- (default: `false`) --- @field escape_slash? boolean --- ---- If non-empty, the returned JSON is formatted with newlines and whitespace, where `indent` ---- defines the whitespace at each nesting level. +--- If non-empty, each value in a JSON object or array starts on a new line and is prefixed with +--- `indent` per nesting level. Adds a space after colons. Does not add a final newline. --- (default: `""`) --- @field indent? string --- diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index a5822c9c84..347862e865 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -90,7 +90,7 @@ function vim.fn.api_info() end --- @return 0|1 function vim.fn.append(lnum, text) end ---- Like |append()| but append the text in buffer {expr}. +--- Like |append()| but append the text in buffer {buf}. --- --- This function works only for loaded buffers. First call --- |bufload()| if needed. diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index fde0af2f0e..c068aed005 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -806,12 +806,14 @@ vim.v.version = ... vim.v.versionlong = ... --- 0 during startup, 1 just before `VimEnter`. +--- See also `v:vim_did_init`, which is set earlier. --- Read-only. --- @type integer vim.v.vim_did_enter = ... ---- 0 during initialization, 1 after sourcing `vimrc` and just ---- before `load-plugins`. +--- 0 during initialization, 1 after sourcing the user `vimrc`, +--- just before `load-plugins`. +--- See also `v:vim_did_enter`, which is set later. --- Read-only. --- @type integer vim.v.vim_did_init = ... diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua index 41e08eeeb2..d50ce39eac 100644 --- a/runtime/lua/vim/fs.lua +++ b/runtime/lua/vim/fs.lua @@ -1,4 +1,13 @@ --- @brief
help
+--- *vim.fs.copy()*
+--- Use |filecopy()| or |uv.fs_copyfile()| to performantly copy an existing file.
+---
+--- Example:
+---
+--- >lua
+---   vim.fn.filecopy('foo.txt', 'bar.txt')
+--- <
+---
 --- *vim.fs.exists()*
 --- Use |uv.fs_stat()| to check a file's type, and whether it exists.
 ---
diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua
index eeb2b045e2..28ae4bfee0 100644
--- a/runtime/lua/vim/ui.lua
+++ b/runtime/lua/vim/ui.lua
@@ -23,16 +23,13 @@ local M = {}
 ---
 --- ```lua
 --- vim.ui.select({ 'tabs', 'spaces' }, {
----     prompt = 'Select tabs or spaces:',
----     format_item = function(item)
----         return "I'd like to choose " .. item
----     end,
+---   prompt = 'Select tabs or spaces:',
+---   format_item = function(item)
+---     return ('I choose %s!'):format(item)
+---   end,
 --- }, function(choice)
----     if choice == 'spaces' then
----         vim.o.expandtab = true
----     else
----         vim.o.expandtab = false
----     end
+---   vim.o.expandtab = choice == 'spaces'
+---   vim.print(('Selected "%s" => expandtab=%s'):format(choice, vim.o.expandtab))
 --- end)
 --- ```
 ---
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index cd06df70d6..280ecc0f05 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -154,6 +154,7 @@ DictAs(get_hl_info) nvim_get_hl(Integer ns_id, Dict(get_highlight) *opts, Arena
 ///                - force: if true force update the highlight group when it exists.
 ///                - link: Name of highlight group to link to. |:hi-link|
 ///                - sp: color name or "#RRGGBB"
+///                - update: boolean (default false) Update specified attributes only, leave others unchanged.
 ///                - altfont: boolean
 ///                - blink: boolean
 ///                - bold: boolean
@@ -170,7 +171,6 @@ DictAs(get_hl_info) nvim_get_hl(Integer ns_id, Dict(get_highlight) *opts, Arena
 ///                - underdotted: boolean
 ///                - underdouble: boolean
 ///                - underline: boolean
-///                - update: boolean false by default; true updates only specified attributes, leaving others unchanged.
 /// @param[out] err Error details, if any
 void nvim_set_hl(uint64_t channel_id, Integer ns_id, String name, Dict(highlight) *val, Error *err)
   FUNC_API_SINCE(7)
@@ -1591,7 +1591,7 @@ ArrayOf(DictAs(get_keymap)) nvim_get_keymap(String mode, Arena *arena)
 /// nmap   
 /// ```
 ///
-/// @param channel_id
+/// @param channel_id Channel id (implicit dispatcher arg)
 /// @param  mode  Mode short-name (map command prefix: "n", "i", "v", "x", …)
 ///               or "!" for |:map!|, or empty string for |:map|.
 ///               "ia", "ca" or "!a" for abbreviation in Insert mode, Cmdline mode, or both, respectively
@@ -1650,7 +1650,7 @@ ArrayOf(Object, 2) nvim_get_api_info(uint64_t channel_id, Arena *arena)
 /// Can be called more than once; caller should merge old info if appropriate. Example: a library
 /// first identifies the channel, then a plugin using that library later identifies itself.
 ///
-/// @param channel_id
+/// @param channel_id Channel id (implicit dispatcher arg)
 /// @param name Client short-name. Sets the `client.name` field of |nvim_get_chan_info()|.
 /// @param version  Dict describing the version, with these
 ///     (optional) keys:
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index a75c8720dd..a52b066021 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -161,7 +161,7 @@ M.funcs = {
     args = 3,
     base = 3,
     desc = [=[
-      Like |append()| but append the text in buffer {expr}.
+      Like |append()| but append the text in buffer {buf}.
 
       This function works only for loaded buffers.  First call
       |bufload()| if needed.
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index b14fa990e6..7c4e42420a 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1016,7 +1016,7 @@ static void nlua_print_event(void **argv)
   msg_multihl(NIL, msg, "lua_print", true, false, NULL, &needs_clear);
 }
 
-/// Print as a Vim message
+/// Implements Lua print() as a Nvim message.
 ///
 /// @param  lstate  Lua interpreter state.
 static int nlua_print(lua_State *const lstate)
diff --git a/src/nvim/vvars.lua b/src/nvim/vvars.lua
index 0136bbd9e1..26a62830d1 100644
--- a/src/nvim/vvars.lua
+++ b/src/nvim/vvars.lua
@@ -916,14 +916,16 @@ M.vars = {
     type = 'integer',
     desc = [=[
       0 during startup, 1 just before |VimEnter|.
+      See also |v:vim_did_init|, which is set earlier.
       Read-only.
     ]=],
   },
   vim_did_init = {
     type = 'integer',
     desc = [=[
-      0 during initialization, 1 after sourcing |vimrc| and just
-      before |load-plugins|.
+      0 during initialization, 1 after sourcing the user |vimrc|,
+      just before |load-plugins|.
+      See also |v:vim_did_enter|, which is set later.
       Read-only.
     ]=],
   },
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index 1707a0728b..840fd54423 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -262,14 +262,14 @@ describe('API: set highlight', function()
     api.nvim_set_hl(0, 'TestGroup', { fg = '#ff0000', bg = '#0000ff', bold = true })
     api.nvim_set_hl(0, 'TestGroup', { bg = '#00ff00', update = true })
     local hl = api.nvim_get_hl(0, { name = 'TestGroup' })
-    eq(16711680, hl.fg)
-    eq(65280, hl.bg)
+    eq(tonumber('0xff0000'), hl.fg)
+    eq(tonumber('0x00ff00'), hl.bg)
     eq(true, hl.bold)
 
     api.nvim_set_hl(0, 'TestGroup', { bold = false, update = true })
     hl = api.nvim_get_hl(0, { name = 'TestGroup' })
     eq(nil, hl.bold)
-    eq(16711680, hl.fg)
+    eq(tonumber('0xff0000'), hl.fg)
 
     api.nvim_set_hl(0, 'TestGroup', { italic = true })
 
@@ -282,7 +282,7 @@ describe('API: set highlight', function()
     api.nvim_set_hl(ns, 'TestGroup', { fg = '#ff0000', italic = true })
     api.nvim_set_hl(ns, 'TestGroup', { fg = '#00ff00', update = true })
     hl = api.nvim_get_hl(ns, { name = 'TestGroup' })
-    eq(65280, hl.fg)
+    eq(tonumber('0x00ff00'), hl.fg)
     eq(true, hl.italic)
 
     api.nvim_set_hl(0, 'LinkedGroup', { link = 'Normal' })
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index fca5c968dd..8809142f2e 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -1701,7 +1701,7 @@ describe('cmdheight=0', function()
     ]])
   end)
 
-  it('no spurious newline before first message in headless mode', function()
+  it('no spurious newline before first message with --headless mode', function()
     local p = n.spawn_wait({
       args = { '--cmd', 'set cmdheight=0', '-c', 'echo 1', '+q' },
     })