From 454ae672aad172a299dcff7c33c5e61a3b631c90 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 14 Nov 2024 11:53:20 +0000 Subject: feat(lsp): deprecate non-method client functions Deprecated: - `client.request()` -> `client:request()` - `client.request_sync()` -> `client:request_sync()` - `client.notify()` -> `client:notify()` - `client.cancel_request()` -> `client:cancel_request()` - `client.stop()` -> `client:stop()` - `client.is_stopped()` `client:is_stopped()` - `client.supports_method()` -> `client:supports_method()` - `client.on_attach()` -> `client:on_attach()` Fixed docgen to link class fields to the full function doc. --- runtime/doc/lua.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 243c907180..4d4a51872a 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1937,12 +1937,10 @@ vim.show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()* *vim.Ringbuf* Fields: ~ - • {clear} (`fun()`) Clear all items - • {push} (`fun(item: T)`) Adds an item, overriding the oldest item if - the buffer is full. - • {pop} (`fun(): T?`) Removes and returns the first unread item - • {peek} (`fun(): T?`) Returns the first unread item without removing - it + • {clear} (`fun()`) See |Ringbuf:clear()|. + • {push} (`fun(item: T)`) See |Ringbuf:push()|. + • {pop} (`fun(): T?`) See |Ringbuf:pop()|. + • {peek} (`fun(): T?`) See |Ringbuf:peek()|. Ringbuf:clear() *Ringbuf:clear()* -- cgit From 3d707e6f14b7db64b3510f58bf9321c71163f552 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 26 Nov 2024 06:15:50 -0800 Subject: fix(lua): remove vim.loader.disable() #31344 Problem: `vim.loader.disable` does not conform to `:help dev-name-common` and `:help dev-patterns`. Solution: - Add `enable` parameter to `vim.loader.enable` - Remove `vim.loader.disable` - Note the change in `:help news-breaking-dev` (HEAD changes). - This is not a breaking change (except to "HEAD") because `vim.loader` is marked "experimental". previous: 26765e8461c1ba1e9a351632212cf89900221781 --- runtime/doc/lua.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 4d4a51872a..cf53825c68 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2485,22 +2485,24 @@ vim.validate({name}, {value}, {validator}, {optional}, {message}) ============================================================================== Lua module: vim.loader *vim.loader* -vim.loader.disable() *vim.loader.disable()* +vim.loader.enable({enable}) *vim.loader.enable()* WARNING: This feature is experimental/unstable. - Disables the experimental Lua module loader: - • removes the loaders - • adds the default Nvim loader + Enables or disables the experimental Lua module loader: -vim.loader.enable() *vim.loader.enable()* - WARNING: This feature is experimental/unstable. - - Enables the experimental Lua module loader: - • overrides loadfile + Enable (`enable=true`): + • overrides |loadfile()| • adds the Lua loader using the byte-compilation cache • adds the libs loader • removes the default Nvim loader + Disable (`enable=false`): + • removes the loaders + • adds the default Nvim loader + + Parameters: ~ + • {enable} (`boolean?`) true/nil to enable, false to disable + vim.loader.find({modname}, {opts}) *vim.loader.find()* WARNING: This feature is experimental/unstable. -- cgit From 76dcc7029b200e1d85024d7ba4a34c602e730dbe Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 27 Nov 2024 15:36:38 +0100 Subject: docs: add tag `vim.fs.exists()` and document suggested replacement --- runtime/doc/lua.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index cf53825c68..c3dddaf888 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2926,6 +2926,17 @@ vim.keymap.set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* ============================================================================== Lua module: vim.fs *vim.fs* + + *vim.fs.exists()* +Use |uv.fs_stat()| to check a file's type, and whether it exists. + +Example: >lua + if vim.uv.fs_stat(file) then + vim.print("file exists") + end +< + + vim.fs.basename({file}) *vim.fs.basename()* Return the basename of the given path -- cgit From feb62d5429680278c1353c565db6bb3ecb3b7c24 Mon Sep 17 00:00:00 2001 From: "C.D. MacEachern" Date: Sun, 1 Dec 2024 16:58:28 -0500 Subject: docs: example keybind for :Inspect #31391 --- runtime/doc/lua.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index c3dddaf888..047e263768 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1911,6 +1911,11 @@ vim.show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()* Can also be shown with `:Inspect`. *:Inspect* + Example: To bind this function to the vim-scriptease inspired `zS` in + Normal mode: >lua + vim.keymap.set('n', 'zS', vim.show_pos) +< + Attributes: ~ Since: 0.9.0 -- cgit From ae93c7f369a174f3d738ab55030de2c9dfc10c57 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 3 Dec 2024 09:44:28 -0800 Subject: docs: misc, help tags for neovim.io searches #31428 Problem: Various keywords are commonly searched-for on https://neovim.io, but don't have help tags. Solution: Add help tags. fix #31327 --- runtime/doc/lua.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 047e263768..48fa595a53 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -17,9 +17,9 @@ get an idea of what lurks beneath: >vim :lua vim.print(package.loaded) Nvim includes a "standard library" |lua-stdlib| for Lua. It complements the -"editor stdlib" (|builtin-functions| and |Ex-commands|) and the |API|, all of -which can be used from Lua code (|lua-vimscript| |vim.api|). Together these -"namespaces" form the Nvim programming interface. +"editor stdlib" (|vimscript-functions| + |Ex-commands|) and the |API|, all of +which can be used from Lua code (|lua-vimscript| |vim.api|). These three +namespaces form the Nvim programming interface. Lua plugins and user config are automatically discovered and loaded, just like Vimscript. See |lua-guide| for practical guidance. -- cgit From 517ecb85f58ed6ac8b4d5443931612e75e7c7dc2 Mon Sep 17 00:00:00 2001 From: Bartłomiej Maryńczak Date: Fri, 6 Dec 2024 21:43:41 +0100 Subject: feat(stdlib): vim.json.encode(...,{escape_slash:boolean}) #30561 Problem: vim.json.encode escapes every slash in string values (for example in file paths), and is not optional. Use-case is for preventing HTML injections (eg. injecting `` closing tag); in the context of Nvim this is rarely useful. Solution: - Add a `escape_slash` flag to `vim.json.encode`. - Defaults to `false`. (This is a "breaking" change, but more like a bug fix.) --- runtime/doc/lua.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 48fa595a53..80808abd51 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -811,11 +811,14 @@ vim.json.decode({str}, {opts}) *vim.json.decode()* Return: ~ (`any`) -vim.json.encode({obj}) *vim.json.encode()* +vim.json.encode({obj}, {opts}) *vim.json.encode()* Encodes (or "packs") Lua object {obj} as JSON in a Lua string. Parameters: ~ - • {obj} (`any`) + • {obj} (`any`) + • {opts} (`table?`) Options table with keys: + • escape_slash: (boolean) (default false) When true, escapes + `/` character in JSON strings Return: ~ (`string`) -- cgit From 3bb2d027597107a3d7f84ef61507104fd4dc050a Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Sun, 8 Dec 2024 19:18:40 -0800 Subject: docs: fix type of vim.validate value --- runtime/doc/lua.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 80808abd51..dad3d92238 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2477,7 +2477,7 @@ vim.validate({name}, {value}, {validator}, {optional}, {message}) Parameters: ~ • {name} (`string`) Argument name - • {value} (`string`) Argument value + • {value} (`any`) Argument value • {validator} (`vim.validate.Validator`) • (`string|string[]`): Any value that can be returned from |lua-type()| in addition to `'callable'`: -- cgit From 55c5d0de262b8a9eb03a65f6e6f45e8d26213eb4 Mon Sep 17 00:00:00 2001 From: Lukasz Piepiora Date: Mon, 23 Dec 2024 14:08:20 +0100 Subject: docs(api): vim.version.range():has() method #31622 Problem: The :has() method of the vim.version.range() result is not documented though it's mentioned in examples. Solution: Mention it in the range() result doc. --- runtime/doc/lua.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index dad3d92238..711607d14b 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -3998,6 +3998,7 @@ vim.version.range({spec}) *vim.version.range()* (`table?`) A table with the following fields: • {from} (`vim.Version`) • {to}? (`vim.Version`) + • {has} (`fun(self: vim.VersionRange, version: string|vim.Version)`) See also: ~ • https://github.com/npm/node-semver#ranges -- cgit From 518070731003e30ea7eee96e76ccdf7b950c90da Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Fri, 5 Apr 2024 14:48:13 +0600 Subject: feat(lua): add `vim.fs.abspath` Problem: There is currently no way to check if a given path is absolute or convert a relative path to an absolute path through the Lua stdlib. `vim.fs.joinpath` does not work when the path is absolute. There is also currently no way to resolve `C:foo\bar` style paths in Windows. Solution: Add `vim.fs.abspath`, which allows converting any path to an absolute path. This also allows checking if current path is absolute by doing `vim.fs.abspath(path) == path`. It also has support for `C:foo\bar` style paths in Windows. --- runtime/doc/lua.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 711607d14b..a2a83ef229 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2945,6 +2945,20 @@ Example: >lua < +vim.fs.abspath({path}) *vim.fs.abspath()* + Convert path to an absolute path. A tilde (~) character at the beginning + of the path is expanded to the user's home directory. Does not check if + the path exists, normalize the path, resolve symlinks or hardlinks + (including `.` and `..`), or expand environment variables. If the path is + already absolute, it is returned unchanged. Also converts `\` path + separators to `/`. + + Parameters: ~ + • {path} (`string`) Path + + Return: ~ + (`string`) Absolute path + vim.fs.basename({file}) *vim.fs.basename()* Return the basename of the given path -- cgit From 0bef3b911cc262a007fb4412d864c1832d1268ad Mon Sep 17 00:00:00 2001 From: Gustav Eikaas <46537983+GustavEikaas@users.noreply.github.com> Date: Tue, 31 Dec 2024 16:40:05 +0100 Subject: fix(vim.fs): joinpath() does not normalize slashes on Windows #31782 --- runtime/doc/lua.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index a2a83ef229..022adb3da7 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -3062,8 +3062,11 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* items vim.fs.joinpath({...}) *vim.fs.joinpath()* - Concatenate directories and/or file paths into a single path with - normalization (e.g., `"foo/"` and `"bar"` get joined to `"foo/bar"`) + Concatenates partial paths into one path. Slashes are normalized + (redundant slashes are removed, and on Windows backslashes are replaced + with forward-slashes) (e.g., `"foo/"` and `"/bar"` get joined to + `"foo/bar"`) (windows: e.g `"a\foo\"` and `"\bar"` are joined to + `"a/foo/bar"`) Attributes: ~ Since: 0.10.0 -- cgit From dc692f553aae367a03f286e0d59561247941f96c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 1 Jan 2025 12:29:51 -0800 Subject: docs: misc #31479 --- runtime/doc/lua.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 022adb3da7..25e58c0240 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -817,8 +817,8 @@ vim.json.encode({obj}, {opts}) *vim.json.encode()* Parameters: ~ • {obj} (`any`) • {opts} (`table?`) Options table with keys: - • escape_slash: (boolean) (default false) When true, escapes - `/` character in JSON strings + • escape_slash: (boolean) (default false) Escape slash + characters "/" in string values. Return: ~ (`string`) @@ -3062,11 +3062,13 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* items vim.fs.joinpath({...}) *vim.fs.joinpath()* - Concatenates partial paths into one path. Slashes are normalized - (redundant slashes are removed, and on Windows backslashes are replaced - with forward-slashes) (e.g., `"foo/"` and `"/bar"` get joined to - `"foo/bar"`) (windows: e.g `"a\foo\"` and `"\bar"` are joined to - `"a/foo/bar"`) + Concatenates partial paths (one absolute or relative path followed by zero + or more relative paths). Slashes are normalized: redundant slashes are + removed, and (on Windows) backslashes are replaced with forward-slashes. + + Examples: + • "foo/", "/bar" => "foo/bar" + • Windows: "a\foo\", "\bar" => "a/foo/bar" Attributes: ~ Since: 0.10.0 -- cgit From 48e2a73610ca5639408f79b3d8eebd3e5f57a327 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Thu, 2 Jan 2025 14:51:03 +0100 Subject: feat(ui)!: emit prompt "messages" as cmdline events #31525 Problem: Prompts are emitted as messages events, where cmdline events are more appropriate. The user input is also emitted as message events in fast context, so cannot be displayed with vim.ui_attach(). Solution: Prompt for user input through cmdline prompts. --- runtime/doc/lua.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 25e58c0240..463389ed65 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1086,9 +1086,8 @@ vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()* |ui-popupmenu| and the sections below for event format for respective events. - Callbacks for `msg_show` events are executed in |api-fast| context unless - Nvim will wait for input, in which case messages should be shown - immediately. + Callbacks for `msg_show` events are executed in |api-fast| context; + showing the message should be scheduled. Excessive errors inside the callback will result in forced detachment. -- cgit From b52531a9cbbd1843490333452cd124e8be070690 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 3 Jan 2025 08:29:36 -0800 Subject: docs: misc #31822 * docs: drop "lua-" prefix from most treesitter tags * docs: move mouse section from tui.txt to gui.txt * docs: misc --- runtime/doc/lua.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 463389ed65..b7c5a50443 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1473,10 +1473,8 @@ vim.go *vim.go* < vim.o *vim.o* - Get or set |options|. Like `:set`. Invalid key is an error. - - Note: this works on both buffer-scoped and window-scoped options using the - current buffer and window. + Get or set |options|. Works like `:set`, so buffer/window-scoped options + target the current buffer/window. Invalid key is an error. Example: >lua vim.o.cmdheight = 4 -- cgit From 5e02a2c47072ec08279b830daa6f82e39ba86c6e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 5 Jan 2025 17:10:16 -0800 Subject: "nvim -es": disable shada #21723 Problem: `nvim -es` (and `nvim -Es`) is the recommended way to non-interactively run commands/vimscript. But it enables shada by default, which is usually not wanted. Solution: - Disable shada by default for `nvim -es/-Es`. This can be overridden by `-i foo` if needed. - Do NOT change the 'loadplugins' default. - User config + packages _should_ be enabled by default, for both `nvim -es` and `nvim -l`. Else any Lua packages you have can't be accessed without `-u path/to/config`, which is clumsy. - Use-cases: ``` nvim --headless "+Lazy! sync" +qa would become: nvim -es "+Lazy! sync" nvim --headless +PlugInstall +qall would become: nvim -es +PlugInstall ``` - Opt-out (`--clean` or `-u NONE`) is much easier than opt-in (`-u path/to/config`). - User config/packages are analogous to pip packages, which are expected when doing `python -c ...`. related: 7c94bcd2d77e2e54b8836ab8325460a367b79eae related: ddd0eb6f5120a09b97867d2561ea61309038ccd2 --- runtime/doc/lua.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index b7c5a50443..6547a76f56 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -618,20 +618,20 @@ Example: TCP echo-server *tcp-server* Multithreading *lua-loop-threading* Plugins can perform work in separate (os-level) threads using the threading -APIs in luv, for instance `vim.uv.new_thread`. Note that every thread -gets its own separate Lua interpreter state, with no access to Lua globals -in the main thread. Neither can the state of the editor (buffers, windows, -etc) be directly accessed from threads. +APIs in luv, for instance `vim.uv.new_thread`. Each thread has its own +separate Lua interpreter state, with no access to Lua globals on the main +thread. Neither can the editor state (buffers, windows, etc) be directly +accessed from threads. -A subset of the `vim.*` API is available in threads. This includes: +A subset of the `vim.*` stdlib is available in threads, including: - `vim.uv` with a separate event loop per thread. - `vim.mpack` and `vim.json` (useful for serializing messages between threads) - `require` in threads can use Lua packages from the global |package.path| - `print()` and `vim.inspect` - `vim.diff` -- most utility functions in `vim.*` for working with pure Lua values - like `vim.split`, `vim.tbl_*`, `vim.list_*`, and so on. +- Most utility functions in `vim.*` that work with pure Lua values, like + `vim.split`, `vim.tbl_*`, `vim.list_*`, etc. - `vim.is_thread()` returns true from a non-main thread. -- cgit From 0c296ab22484b4c009d119908d1614a6c6d96b2c Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Thu, 9 Jan 2025 08:36:16 -0800 Subject: feat(docs): "yxx" runs Lua/Vimscript code examples #31904 `yxx` in Normal mode over a Lua or Vimscript code block section will execute the code. Co-authored-by: Justin M. Keyes --- runtime/doc/lua.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 6547a76f56..6386240f07 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -161,7 +161,7 @@ languages like Python and C#. Example: >lua local func_with_opts = function(opts) local will_do_foo = opts.foo local filename = opts.filename - ... + -- ... end func_with_opts { foo = true, filename = "hello.world" } @@ -2428,7 +2428,7 @@ vim.validate({name}, {value}, {validator}, {optional}, {message}) function vim.startswith(s, prefix) vim.validate('s', s, 'string') vim.validate('prefix', prefix, 'string') - ... + -- ... end < 2. `vim.validate(spec)` (deprecated) where `spec` is of type @@ -2442,7 +2442,7 @@ vim.validate({name}, {value}, {validator}, {optional}, {message}) age={age, 'number'}, hobbies={hobbies, 'table'}, } - ... + -- ... end < -- cgit From 7c00e0efbb18e8627ac59eaadf564a9f1b2bafcd Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 9 Jan 2025 09:26:45 -0800 Subject: docs: misc #31867 --- runtime/doc/lua.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 6386240f07..9df9bc3ab5 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1505,7 +1505,7 @@ vim.wo[{winid}][{bufnr}] *vim.wo* Lua module: vim *lua-vim* vim.cmd({command}) *vim.cmd()* - Executes Vim script commands. + Executes Vimscript (|Ex-commands|). Note that `vim.cmd` can be indexed with a command name to return a callable function to the command. @@ -1539,9 +1539,9 @@ vim.cmd({command}) *vim.cmd()* Parameters: ~ • {command} (`string|table`) Command(s) to execute. If a string, - executes multiple lines of Vim script at once. In this - case, it is an alias to |nvim_exec2()|, where `opts.output` - is set to false. Thus it works identical to |:source|. If a + executes multiple lines of Vimscript at once. In this case, + it is an alias to |nvim_exec2()|, where `opts.output` is + set to false. Thus it works identical to |:source|. If a table, executes a single command. In this case, it is an alias to |nvim_cmd()| where `opts` is empty. -- cgit From 6a425e7045cca609d95612c0f2cd08d0265238a9 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 24 Nov 2024 11:29:39 +0100 Subject: docs: misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Axel Co-authored-by: Colin Kennedy Co-authored-by: Daiki Noda Co-authored-by: Evgeni Chasnovski Co-authored-by: Jean-Jacq du Plessis <1030058+jj-du-plessis@users.noreply.github.com> Co-authored-by: Juan Giordana Co-authored-by: Lincoln Wallace Co-authored-by: Matti Hellström Co-authored-by: Steven Locorotondo Co-authored-by: Yochem van Rosmalen Co-authored-by: glepnir Co-authored-by: ifish --- runtime/doc/lua.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 9df9bc3ab5..a84a364847 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1299,7 +1299,7 @@ global value of a |global-local| option, see |:setglobal|. A special interface |vim.opt| exists for conveniently interacting with list- -and map-style option from Lua: It allows accessing them as Lua tables and +and map-style options from Lua: It allows accessing them as Lua tables and offers object-oriented method for adding and removing entries. Examples: ~ @@ -1805,7 +1805,7 @@ vim.system({cmd}, {opts}, {on_exit}) *vim.system()* -- Runs synchronously: local obj = vim.system({'echo', 'hello'}, { text = true }):wait() - -- { code = 0, signal = 0, stdout = 'hello', stderr = '' } + -- { code = 0, signal = 0, stdout = 'hello\n', stderr = '' } < See |uv.spawn()| for more details. Note: unlike |uv.spawn()|, vim.system -- cgit From 0631492f9c8044a378dc2a17ea257badfbda6d15 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 30 Dec 2024 16:01:00 +0100 Subject: feat: add vim.fs.relpath This is needed to replace the nvim-lspconfig function is_descendant that some lspconfg configurations still use. --- runtime/doc/lua.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index a84a364847..44cbf238cf 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -3148,6 +3148,23 @@ vim.fs.parents({start}) *vim.fs.parents()* (`nil`) (`string?`) +vim.fs.relpath({base}, {target}, {opts}) *vim.fs.relpath()* + Gets `target` path relative to `base`, or `nil` if `base` is not an + ancestor. + + Example: >lua + vim.fs.relpath('/var', '/var/lib') -- 'lib' + vim.fs.relpath('/var', '/usr/bin') -- nil +< + + Parameters: ~ + • {base} (`string`) + • {target} (`string`) + • {opts} (`table?`) Reserved for future use + + Return: ~ + (`string?`) + vim.fs.rm({path}, {opts}) *vim.fs.rm()* WARNING: This feature is experimental/unstable. -- cgit From 611ef354919f1c6564efd2ff8074545941458ccc Mon Sep 17 00:00:00 2001 From: Mike <4576770+mike325@users.noreply.github.com> Date: Wed, 15 Jan 2025 01:39:17 +0100 Subject: feat(vim.fs): find(), dir() can "follow" symlinks #31551 Problem: vim.fs.dir(), vim.fs.find() do not follow symlinks. Solution: - Add "follow" flag. - Enable it by default. --- runtime/doc/lua.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 44cbf238cf..6e5a77ff7a 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2983,6 +2983,7 @@ vim.fs.dir({path}, {opts}) *vim.fs.dir()* • skip: (fun(dir_name: string): boolean)|nil Predicate to control traversal. Return false to stop searching the current directory. Only useful when depth > 1 + • follow: boolean|nil Follow symbolic links. (default: true) Return: ~ (`Iterator`) over items in {path}. Each iteration yields two values: @@ -3024,7 +3025,7 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* -- get all files ending with .cpp or .hpp inside lib/ local cpp_hpp = vim.fs.find(function(name, path) - return name:match('.*%.[ch]pp$') and path:match('[/\\\\]lib$') + return name:match('.*%.[ch]pp$') and path:match('[/\\]lib$') end, {limit = math.huge, type = 'file'}) < @@ -3038,8 +3039,10 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* If {names} is a function, it is called for each traversed item with args: • name: base name of the current item - • path: full path of the current item The function should - return `true` if the given item is considered a match. + • path: full path of the current item + + The function should return `true` if the given item is + considered a match. • {opts} (`table`) Optional keyword arguments: • {path}? (`string`) Path to begin searching from. If omitted, the |current-directory| is used. @@ -3053,6 +3056,8 @@ vim.fs.find({names}, {opts}) *vim.fs.find()* • {limit}? (`number`, default: `1`) Stop the search after finding this many matches. Use `math.huge` to place no limit on the number of matches. + • {follow}? (`boolean`, default: `true`) Follow symbolic + links. Return: ~ (`string[]`) Normalized paths |vim.fs.normalize()| of all matching -- cgit From af0ef2ac9dd19b7c4005a3197334d3e7d554646c Mon Sep 17 00:00:00 2001 From: Siddhant Agarwal <68201519+siddhantdev@users.noreply.github.com> Date: Wed, 22 Jan 2025 21:16:24 +0530 Subject: feat(lua): vim.hl.range() "timeout" #32012 Problem: `vim.hl.on_yank()` has a "timeout" behavior but this is not available for `vim.hl.range()`. Solution: Add `timeout` arg to `vim.hl.range()`. --- runtime/doc/lua.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/doc/lua.txt') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 6e5a77ff7a..0eca3286d0 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -685,6 +685,8 @@ vim.hl.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts}) whether the range is end-inclusive • {priority}? (`integer`, default: `vim.hl.priorities.user`) Highlight priority + • {timeout}? (`integer`, default: -1 no timeout) Time in ms + before highlight is cleared ============================================================================== -- cgit