diff --git a/INSTALL.md b/INSTALL.md index e845feab09..e213e98978 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -19,7 +19,8 @@ Downloads are available on the [Releases](https://github.com/neovim/neovim/relea * [macOS arm64](https://github.com/neovim/neovim/releases/latest/download/nvim-macos-arm64.tar.gz) * [Linux x86_64](https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz) * [Linux arm64](https://github.com/neovim/neovim/releases/latest/download/nvim-linux-arm64.tar.gz) - * [Windows](https://github.com/neovim/neovim/releases/latest/download/nvim-win64.msi) + * [Windows x86_64](https://github.com/neovim/neovim/releases/latest/download/nvim-win64.msi) + * [Windows arm64](https://github.com/neovim/neovim/releases/latest/download/nvim-win-arm64.msi) * Latest [development prerelease](https://github.com/neovim/neovim/releases/nightly) @@ -53,6 +54,7 @@ Several Neovim GUIs are available from scoop (extras): [scoop.sh/#/apps?q=neovim ### Pre-built archives 0. If you are missing `VCRUNTIME170.dll`, install the [Visual Studio C++ redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist) (choose x86_64 or x86 depending on your system). + - Hint: if you have scoop, try: `scoop install vcredist` 1. Choose a package (**nvim-winXX.zip**) from the [releases page](https://github.com/neovim/neovim/releases). 2. Unzip the package. Any location is fine, administrator privileges are _not_ required. - `$VIMRUNTIME` will be set to that location automatically. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index dbbb7c6ece..d057f8a471 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -397,6 +397,7 @@ CTRL-D List names that match the pattern in front of the cursor. to the end. The 'wildoptions' option can be set to "tagfile" to list the file of matching tags. + *c_CTRL-I* *c_wildchar* *c_* */_* 'wildchar' option A match is done on the pattern in front of the cursor. The @@ -412,20 +413,25 @@ CTRL-D List names that match the pattern in front of the cursor. literal instead of triggering completion. The behavior can be changed with the 'wildmode' option. + *c_* Like 'wildchar' or , but begin with the last match and then go to the previous match. + *c_CTRL-N* CTRL-N After using 'wildchar' which got multiple matches, go to next match. Otherwise recall more recent command-line from history. + *c_CTRL-P* CTRL-P After using 'wildchar' which got multiple matches, go to previous match. Otherwise recall older command-line from history. + *c_CTRL-A* CTRL-A All names that match the pattern in front of the cursor are inserted. + *c_CTRL-L* CTRL-L A match is done on the pattern in front of the cursor. If there is one match, it is inserted in place of the pattern. @@ -439,19 +445,22 @@ CTRL-L A match is done on the pattern in front of the cursor. If 'ignorecase' and 'smartcase' are set and the command line has no uppercase characters, the added character is converted to lowercase. + *c_CTRL-G* */_CTRL-G* -CTRL-G When 'incsearch' is set, entering a search pattern for "/" or - "?" and the current match is displayed then CTRL-G will move - to the next match (does not take |search-offset| into account) - Use CTRL-T to move to the previous match. Hint: on a regular - keyboard G is below T. +CTRL-G While the "/" or "?" 'incsearch' prompt is active, CTRL-G + moves to the next match (without changing the |jumplist|). + Does not take |search-offset| into account. + + Use CTRL-T to move to the previous match. + Mnemonic: on a regular keyboard G is below T. + *c_CTRL-T* */_CTRL-T* -CTRL-T When 'incsearch' is set, entering a search pattern for "/" or - "?" and the current match is displayed then CTRL-T will move - to the previous match (does not take |search-offset| into - account). - Use CTRL-G to move to the next match. Hint: on a regular - keyboard T is above G. +CTRL-T While the "/" or "?" 'incsearch' prompt is active, CTRL-T + moves to the previous match (without changing the |jumplist|). + Does not take |search-offset| into account. + + Use CTRL-G to move to the next match. + Mnemonic: on a regular keyboard T is above G. The 'wildchar' option defaults to (CTRL-E when in Vi compatible mode; in a previous version was used). In the pattern standard |wildcards| are diff --git a/runtime/doc/dev_arch.txt b/runtime/doc/dev_arch.txt index b105d1e8d4..dac2831ecb 100644 --- a/runtime/doc/dev_arch.txt +++ b/runtime/doc/dev_arch.txt @@ -69,9 +69,11 @@ Lua code lives in one of four places: - ❌ nvim.difftool - ❌ nvim.tohtml - ❌ nvim.undotree -2. Runtime: `runtime/lua/vim/`. Lazy-loaded modules. Examples: `treesitter`, `lpeg`. -3. Core: `runtime/lua/vim/_core/`. Compiled-into Nvim binary, may directly - interact with Nvim internals. Only available in the main thread. See +2. Stdlib: `runtime/lua/vim/`. Modules on `vim.*`, lazy-loaded (as opposed to + "Core" modules, see below). + - Examples: `vim.treesitter`, `vim.lpeg`. +3. Core: `runtime/lua/vim/_core/`. Internal-only, compiled-in modules. May + directly interact with Nvim internals. Only available in main thread. See |dev-lua-builtin| below. 4. "Shared" core: `runtime/lua/vim/_core/shared.lua`. Pure Lua functions which always are available. Used in the test runner, and worker threads/processes diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 297af595c3..e28b151a4d 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -4198,12 +4198,12 @@ vim.net.request({url}, {opts}, {on_response}) *vim.net.request()* result to the specified `on_response`, `outpath` or `outbuf`. Examples: >lua - -- Write response body to file + -- Write response body to file. vim.net.request('https://neovim.io/charter/', { outpath = 'vision.html', }) - -- Process the response + -- Process the response. vim.net.request( 'https://api.github.com/repos/neovim/neovim', {}, @@ -4214,14 +4214,14 @@ vim.net.request({url}, {opts}, {on_response}) *vim.net.request()* end ) - -- Write to both file and current buffer, but cancel it + -- Write to both file and current buffer, but cancel it. local job = vim.net.request('https://neovim.io/charter/', { outpath = 'vision.html', outbuf = 0, }) job:close() - -- Add custom headers in the request + -- Add custom headers in the request. vim.net.request('https://neovim.io/charter/', { headers = { Authorization = 'Bearer XYZ' }, }) @@ -4237,19 +4237,19 @@ vim.net.request({url}, {opts}, {on_response}) *vim.net.request()* body to. • {outbuf}? (`integer`) Buffer to save the response body to. - • {headers}? (`table`) Table of custom - headers to send with the request. Supports basic - key/value header formats and empty headers as - supported by curl. Does not support @filename style, - internal header deletion (e.g: 'Header:'). + • {headers}? (`table`) Custom headers + to send with the request. Supports basic key/value + headers and empty headers as supported by curl. Does + not support "@filename" style, internal header + deletion ("Header:"). • {on_response} (`fun(err: string?, response: vim.net.request.Response?)?`) Callback invoked on request completion. The `body` field in the response parameter contains the raw response data (text or binary). Return: ~ - (`{ close: fun() }`) Table with method to cancel, similar to - |vim.SystemObj|. + (`{ close: fun() }`) Object with `close()` method which cancels the + request. ============================================================================== @@ -4270,8 +4270,8 @@ by |vim.Pos| objects. To create a new |vim.Pos| object, call `vim.pos()`. Example: >lua - local pos1 = vim.pos(3, 5) - local pos2 = vim.pos(4, 0) + local pos1 = vim.pos(vim.api.nvim_get_current_buf(), 3, 5) + local pos2 = vim.pos(vim.api.nvim_get_current_buf(), 4, 0) -- Operators are overloaded for comparing two `vim.Pos` objects. if pos1 < pos2 then @@ -4320,7 +4320,7 @@ Pos:to_lsp({position_encoding}) *Pos:to_lsp()* local pos = vim.pos(buf, 3, 5) -- Convert to LSP position, you can call it in a method style. - local lsp_pos = pos:lsp('utf-16') + local lsp_pos = pos:to_lsp('utf-16') < Parameters: ~ @@ -4390,13 +4390,13 @@ Provides operations to compare, calculate, and convert ranges represented by format conversions. Example: >lua - local pos1 = vim.pos(3, 5) - local pos2 = vim.pos(4, 0) + local pos1 = vim.pos(vim.api.nvim_get_current_buf(), 3, 5) + local pos2 = vim.pos(vim.api.nvim_get_current_buf(), 4, 0) -- Create a range from two positions. local range1 = vim.range(pos1, pos2) -- Or create a range from four integers representing start and end positions. - local range2 = vim.range(3, 5, 4, 0) + local range2 = vim.range(vim.api.nvim_get_current_buf(), 3, 5, 4, 0) -- Because `vim.Range` is end exclusive, `range1` and `range2` both represent -- a range starting at the row 3, column 5 and ending at where the row 3 ends diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index cce2b6678a..7b0c6057b6 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -10,6 +10,52 @@ For changes in the previous release, see |news-0.12|. 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 + +• todo + +EXPERIMENTS + +• todo + +LSP + +• todo + +LUA + + +• vim.pos, vim.range always require the `buf` parameter. + +DIAGNOSTICS + +• todo + +OPTIONS + +• todo + +TREESITTER + +• todo + +UI + +• todo + +VIMSCRIPT + +• todo + + ============================================================================== BREAKING CHANGES *news-breaking* @@ -20,7 +66,6 @@ API • |nvim_create_autocmd()|, |nvim_exec_autocmds()| and |nvim_clear_autocmds()| no longer treat an empty non-nil pattern as nil. • |nvim_clear_autocmds()| no longer treats an empty array event as nil. -• `stdpath("log")` moved to `stdpath("state")/logs`. DIAGNOSTICS @@ -28,7 +73,7 @@ DIAGNOSTICS EDITOR -• todo +• `stdpath("log")` moved to `stdpath("state")/logs`. EVENTS @@ -61,11 +106,7 @@ The following new features were added. API -• |vim.lsp.buf.declaration()|, |vim.lsp.buf.definition()|, |vim.lsp.buf.definition()|, - and |vim.lsp.buf.implementation()| now follows 'switchbuf'. - -• |vim.net.request()| opts field now accepts a headers table, with custom -header support. +• todo BUILD @@ -81,7 +122,7 @@ DIAGNOSTICS EDITOR -• |:log| for opening log files +• |:log| opens log files. EVENTS @@ -95,19 +136,21 @@ LSP • LSP capabilities: • `textDocument/foo` … - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_codeLens + https://microsoft.github.io/language-server-protocol/specification/#textDocument_foo • `textDocument/bar` … - https://microsoft.github.io/language-server-protocol/specification/#textDocument_colorPresentation + https://microsoft.github.io/language-server-protocol/specification/#textDocument_bar +• |vim.lsp.buf.declaration()|, |vim.lsp.buf.definition()|, |vim.lsp.buf.definition()|, + and |vim.lsp.buf.implementation()| now follows 'switchbuf'. • Support for nested snippets. LUA +• |vim.net.request()| can specify custom headers by passing `opts.headers`. • |vim.filetype.inspect()| returns a copy of the internal tables used for filetype detection. • Added `__eq` metamethod to |vim.VersionRange|. 2 distinct but representing the same range instances now compare equal. - OPTIONS • todo diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 8aa1fdc620..c01faa5cad 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6335,8 +6335,8 @@ A jump table for the options with a short description can be found at |Q_op|. %-0{minwid}.{maxwid}{item} < All fields except {item} are optional. Use "%%" to show a literal "%" - char. Setting this option to empty (`:set statusline=`) sets its - value to the default. + char. Setting to empty (`:set statusline=`) sets the global value to + the default. *stl-%!* When the option starts with "%!" then it is used as an expression, diff --git a/runtime/doc/plugins.txt b/runtime/doc/plugins.txt index bc49e25880..71dbc051e3 100644 --- a/runtime/doc/plugins.txt +++ b/runtime/doc/plugins.txt @@ -6,7 +6,7 @@ Type |gO| to see the table of contents. ============================================================================== -Plugins and modules included with Nvim *plugins* +Plugins and modules included with Nvim *standard-plugin* Nvim includes various Lua and Vim plugins or modules which may provide commands (such as :TOhtml) or modules that you can optionally require() or diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index ca51109013..1eb5f58c61 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -276,7 +276,7 @@ The global plugins will be discussed first, then the filetype ones |add-filetype-plugin|. -GLOBAL PLUGINS *standard-plugin* +GLOBAL PLUGINS When you start Vim, it will automatically load a number of global plugins. You don't have to do anything for this. They add functionality that most diff --git a/runtime/doc/usr_12.txt b/runtime/doc/usr_12.txt index 124899787c..bbf7bb1f33 100644 --- a/runtime/doc/usr_12.txt +++ b/runtime/doc/usr_12.txt @@ -233,9 +233,9 @@ For other ways to count words, lines and other items, see |count-items|. ============================================================================== *12.6* Find a man page *find-manpage* -While editing a shell script or C program, you are using a command or function -that you want to find the man page for (this is on Unix). Let's first use a -simple way: Move the cursor to the word you want to find help on and press > +While editing a C program, you are using a function that you want to find the +man page for (this is on Unix). Let's first use a simple way: Move the cursor +to the word you want to find help on and press > K diff --git a/runtime/doc/vimfn.txt b/runtime/doc/vimfn.txt index afb253a4f3..159c334108 100644 --- a/runtime/doc/vimfn.txt +++ b/runtime/doc/vimfn.txt @@ -3653,7 +3653,7 @@ getfsize({fname}) *getfsize()* (`integer`) getftime({fname}) *getftime()* - Returns the last modification time of the given file {fname}. + Returns the last modification time ("mtime") of file {fname}. The value is measured as seconds since 1st Jan 1970, and may be passed to |strftime()|. See also |localtime()| and |strftime()|. diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 33774cbee0..d02970714f 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -6757,8 +6757,8 @@ vim.wo.stc = vim.wo.statuscolumn --- ``` --- --- All fields except {item} are optional. Use "%%" to show a literal "%" ---- char. Setting this option to empty (`:set statusline=`) sets its ---- value to the default. +--- char. Setting to empty (`:set statusline=`) sets the global value to +--- the default. --- --- *stl-%!* --- When the option starts with "%!" then it is used as an expression, diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 347862e865..2777995d58 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -3273,7 +3273,7 @@ function vim.fn.getfperm(fname) end --- @return integer function vim.fn.getfsize(fname) end ---- Returns the last modification time of the given file {fname}. +--- Returns the last modification time ("mtime") of file {fname}. --- The value is measured as seconds since 1st Jan 1970, and may --- be passed to |strftime()|. See also --- |localtime()| and |strftime()|. diff --git a/runtime/lua/vim/net.lua b/runtime/lua/vim/net.lua index d8bf5f1eb7..6d63fdc77f 100644 --- a/runtime/lua/vim/net.lua +++ b/runtime/lua/vim/net.lua @@ -15,9 +15,8 @@ local M = {} ---Buffer to save the response body to. ---@field outbuf? integer --- ----Table of custom headers to send with the request. ----Supports basic key/value header formats and empty headers as supported by curl. ----Does not support @filename style, internal header deletion (e.g: 'Header:'). +---Custom headers to send with the request. Supports basic key/value headers and empty headers as +---supported by curl. Does not support "@filename" style, internal header deletion ("Header:"). ---@field headers? table ---@class vim.net.request.Response @@ -30,12 +29,12 @@ local M = {} --- --- Examples: --- ```lua ---- -- Write response body to file +--- -- Write response body to file. --- vim.net.request('https://neovim.io/charter/', { --- outpath = 'vision.html', --- }) --- ---- -- Process the response +--- -- Process the response. --- vim.net.request( --- 'https://api.github.com/repos/neovim/neovim', --- {}, @@ -46,14 +45,14 @@ local M = {} --- end --- ) --- ---- -- Write to both file and current buffer, but cancel it +--- -- Write to both file and current buffer, but cancel it. --- local job = vim.net.request('https://neovim.io/charter/', { --- outpath = 'vision.html', --- outbuf = 0, --- }) --- job:close() --- ---- -- Add custom headers in the request +--- -- Add custom headers in the request. --- vim.net.request('https://neovim.io/charter/', { --- headers = { Authorization = 'Bearer XYZ' }, --- }) @@ -64,7 +63,7 @@ local M = {} --- @param on_response? fun(err: string?, response: vim.net.request.Response?) --- Callback invoked on request completion. The `body` field in the response --- parameter contains the raw response data (text or binary). ---- @return { close: fun() } # Table with method to cancel, similar to [vim.SystemObj]. +--- @return { close: fun() } # Object with `close()` method which cancels the request. function M.request(url, opts, on_response) vim.validate('url', url, 'string') vim.validate('opts', opts, 'table', true) diff --git a/runtime/lua/vim/pos.lua b/runtime/lua/vim/pos.lua index 718e2800e7..65e6a6678f 100644 --- a/runtime/lua/vim/pos.lua +++ b/runtime/lua/vim/pos.lua @@ -18,8 +18,8 @@ local validate = vim.validate --- --- Example: --- ```lua ---- local pos1 = vim.pos(3, 5) ---- local pos2 = vim.pos(4, 0) +--- local pos1 = vim.pos(vim.api.nvim_get_current_buf(), 3, 5) +--- local pos2 = vim.pos(vim.api.nvim_get_current_buf(), 4, 0) --- --- -- Operators are overloaded for comparing two `vim.Pos` objects. --- if pos1 < pos2 then @@ -127,7 +127,7 @@ end --- local pos = vim.pos(buf, 3, 5) --- --- -- Convert to LSP position, you can call it in a method style. ---- local lsp_pos = pos:lsp('utf-16') +--- local lsp_pos = pos:to_lsp('utf-16') --- ``` ---@param position_encoding lsp.PositionEncodingKind function Pos:to_lsp(position_encoding) diff --git a/runtime/lua/vim/range.lua b/runtime/lua/vim/range.lua index 03ad1b3c52..762a33f401 100644 --- a/runtime/lua/vim/range.lua +++ b/runtime/lua/vim/range.lua @@ -20,13 +20,13 @@ local api = vim.api --- --- Example: --- ```lua ---- local pos1 = vim.pos(3, 5) ---- local pos2 = vim.pos(4, 0) +--- local pos1 = vim.pos(vim.api.nvim_get_current_buf(), 3, 5) +--- local pos2 = vim.pos(vim.api.nvim_get_current_buf(), 4, 0) --- --- -- Create a range from two positions. --- local range1 = vim.range(pos1, pos2) --- -- Or create a range from four integers representing start and end positions. ---- local range2 = vim.range(3, 5, 4, 0) +--- local range2 = vim.range(vim.api.nvim_get_current_buf(), 3, 5, 4, 0) --- --- -- Because `vim.Range` is end exclusive, `range1` and `range2` both represent --- -- a range starting at the row 3, column 5 and ending at where the row 3 ends diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 29021dfe73..87abf479ee 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -889,6 +889,7 @@ Union(Integer, String) nvim_echo(ArrayOf(Tuple(String, *HLGroupID)) chunks, Bool const int save_lines_left = lines_left; const bool save_msg_didany = msg_didany; // Similar truncation method to showmode(). + // TODO(justinmk): drop _truncate feature after ui2 graduates? if (opts->_truncate) { no_wait_return++; lines_left = 0; diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index a52b066021..64ff28c61d 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -4100,7 +4100,7 @@ M.funcs = { args = 1, base = 1, desc = [=[ - Returns the last modification time of the given file {fname}. + Returns the last modification time ("mtime") of file {fname}. The value is measured as seconds since 1st Jan 1970, and may be passed to |strftime()|. See also |localtime()| and |strftime()|. diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c index 9780c3ab07..ef067f68e2 100644 --- a/src/nvim/keycodes.c +++ b/src/nvim/keycodes.c @@ -635,11 +635,16 @@ int get_mouse_button(int code, bool *is_click, bool *is_drag) return 0; // Shouldn't get here } -/// Replace any terminal code strings with the equivalent internal representation. +/// Encode `` notation into Nvim's internal key representation. (Does NOT process raw terminal +/// escape sequences, despite the legacy "termcode" terminology.) /// -/// Used for the "from" and "to" part of a mapping, and the "to" part of a menu command. -/// Any strings like "" are also replaced, unless `special` is false. -/// K_SPECIAL by itself is replaced by K_SPECIAL KS_SPECIAL KE_FILLER. +/// Parses keycode notation like ``, ``, ``, ``, ``, ``, and emits +/// the corresponding K_SPECIAL byte sequences. Used for the lhs/rhs of mappings, the rhs of menu +/// commands, and feedkeys input. K_SPECIAL by itself is replaced by K_SPECIAL KS_SPECIAL KE_FILLER. +/// +/// Also handles `` / backslash literal escapes (per 'cpoptions'), ``/`` +/// expansion, `` script-id substitution, and (unless REPTERM_NO_SIMPLIFY) simplifications like +/// `` => 0x08. /// /// When "flags" has REPTERM_FROM_PART, trailing is included, otherwise it is removed (to make /// ":map xx ^V" map xx to nothing). When cpo_val contains CPO_BSLASH, a backslash can be used in diff --git a/src/nvim/options.lua b/src/nvim/options.lua index f33a591475..88789825b4 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -8826,8 +8826,8 @@ local options = { %-0{minwid}.{maxwid}{item} < All fields except {item} are optional. Use "%%" to show a literal "%" - char. Setting this option to empty (`:set statusline=`) sets its - value to the default. + char. Setting to empty (`:set statusline=`) sets the global value to + the default. *stl-%!* When the option starts with "%!" then it is used as an expression,