aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-06-03 11:06:00 +0100
committerGitHub <noreply@github.com>2023-06-03 12:06:00 +0200
commit2db719f6c2b677fcbc197b02fe52764a851523b2 (patch)
tree648885f655ea6eea2d6b5ad9409bc18c3b49e0f7 /runtime/doc
parentc65e2203f70cd5d66fcb8ffb26f8cef38f50e04f (diff)
downloadrneovim-2db719f6c2b677fcbc197b02fe52764a851523b2.tar.gz
rneovim-2db719f6c2b677fcbc197b02fe52764a851523b2.tar.bz2
rneovim-2db719f6c2b677fcbc197b02fe52764a851523b2.zip
feat(lua): rename vim.loop -> vim.uv (#22846)
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/builtin.txt4
-rw-r--r--runtime/doc/deprecated.txt1
-rw-r--r--runtime/doc/help.txt2
-rw-r--r--runtime/doc/lua.txt35
-rw-r--r--runtime/doc/luvref.txt6
-rw-r--r--runtime/doc/news.txt2
6 files changed, 24 insertions, 26 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 7acc764644..27d52b7ac6 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -3927,8 +3927,8 @@ has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The
{feature} argument is a feature name like "nvim-0.2.1" or
"win32", see below. See also |exists()|.
- To get the system name use |vim.loop|.os_uname() in Lua: >
- :lua print(vim.loop.os_uname().sysname)
+ To get the system name use |vim.uv|.os_uname() in Lua: >lua
+ print(vim.uv.os_uname().sysname)
< If the code has a syntax error then Vimscript may skip the
rest of the line. Put |:if| and |:endif| on separate lines to
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 9d4a7324bf..6494c53059 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -144,6 +144,7 @@ TREESITTER FUNCTIONS
LUA
- vim.register_keystroke_callback() Use |vim.on_key()| instead.
- *vim.pretty_print()* Use |vim.print()| instead.
+- *vim.loop* Use |vim.uv| instead.
NORMAL COMMANDS
- *]f* *[f* Same as "gf".
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index a1550d5c8b..aefaa0b7df 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -105,7 +105,7 @@ API (EXTENSIBILITY/SCRIPTING/PLUGINS)
|lua-guide| Nvim Lua guide
|lua| Lua API
|luaref| Lua reference manual
-|luvref| Luv (|vim.loop|) reference manual
+|luvref| Luv (|vim.uv|) reference manual
|autocmd| Event handlers
|job-control| Spawn and control multiple processes
|channel| Nvim asynchronous IO
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index da423ac213..54527c5a50 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -449,29 +449,24 @@ Note that underscore-prefixed functions (e.g. "_os_proc_children") are
internal/private and must not be used by plugins.
------------------------------------------------------------------------------
-VIM.LOOP *lua-loop* *vim.loop*
+VIM.UV *lua-loop* *vim.uv*
-`vim.loop` exposes all features of the Nvim event-loop. This is a low-level
-API that provides functionality for networking, filesystem, and process
-management. Try this command to see available functions: >vim
-
- :lua print(vim.inspect(vim.loop))
-<
-Internally, `vim.loop` wraps the "luv" Lua bindings for the LibUV library;
-see |luv-intro| for a full reference manual.
+`vim.uv` exposes the "luv" Lua bindings for the libUV library that Nvim uses
+for networking, filesystem, and process management, see |luvref.txt|.
+In particular, it allows interacting with the main Nvim |luv-event-loop|.
*E5560* *lua-loop-callbacks*
It is an error to directly invoke `vim.api` functions (except |api-fast|) in
-`vim.loop` callbacks. For example, this is an error: >lua
+`vim.uv` callbacks. For example, this is an error: >lua
- local timer = vim.loop.new_timer()
+ local timer = vim.uv.new_timer()
timer:start(1000, 0, function()
vim.api.nvim_command('echomsg "test"')
end)
<
To avoid the error use |vim.schedule_wrap()| to defer the callback: >lua
- local timer = vim.loop.new_timer()
+ local timer = vim.uv.new_timer()
timer:start(1000, 0, vim.schedule_wrap(function()
vim.api.nvim_command('echomsg "test"')
end))
@@ -484,7 +479,7 @@ Example: repeating timer
2. Execute it with ":luafile %". >lua
-- Create a timer handle (implementation detail: uv_timer_t).
- local timer = vim.loop.new_timer()
+ local timer = vim.uv.new_timer()
local i = 0
-- Waits 1000ms, then repeats every 750ms until timer:close().
timer:start(1000, 750, function()
@@ -504,7 +499,7 @@ Example: File-change detection *watch-file*
5. Observe that the file reloads in Nvim (because on_change() calls
|:checktime|). >lua
- local w = vim.loop.new_fs_event()
+ local w = vim.uv.new_fs_event()
local function on_change(err, fname, status)
-- Do work...
vim.api.nvim_command('checktime')
@@ -528,11 +523,11 @@ Example: TCP echo-server *tcp-server*
4. Connect from any TCP client (e.g. "nc 0.0.0.0 36795"): >lua
local function create_server(host, port, on_connect)
- local server = vim.loop.new_tcp()
+ local server = vim.uv.new_tcp()
server:bind(host, port)
server:listen(128, function(err)
assert(not err, err) -- Check for errors.
- local sock = vim.loop.new_tcp()
+ local sock = vim.uv.new_tcp()
server:accept(sock) -- Accept client connection.
on_connect(sock) -- Start reading messages.
end)
@@ -553,14 +548,14 @@ 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.loop.new_thread`. Note that every thread
+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.
A subset of the `vim.*` API is available in threads. This includes:
-- `vim.loop` with a separate event loop per thread.
+- `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`
@@ -885,7 +880,7 @@ vim.defer_fn({fn}, {timeout}) *vim.defer_fn*
• {timeout} Time in ms to wait before calling {fn}
Returns: ~
- |vim.loop|.new_timer() object
+ |vim.uv|.new_timer() object
vim.wait({time} [, {callback}, {interval}, {fast_only}]) *vim.wait()*
Wait for {time} in milliseconds until {callback} returns `true`.
@@ -2531,7 +2526,7 @@ find({names}, {opts}) *vim.fs.find()*
-- location of Cargo.toml from the current buffer's path
local cargo = vim.fs.find('Cargo.toml', {
upward = true,
- stop = vim.loop.os_homedir(),
+ stop = vim.uv.os_homedir(),
path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
})
diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt
index 79dd1248aa..131e7889e4 100644
--- a/runtime/doc/luvref.txt
+++ b/runtime/doc/luvref.txt
@@ -5,8 +5,8 @@
*luvref*
This file documents the Lua bindings for the LibUV library which is used for
-Nvim's event-loop and is accessible from Lua via |vim.loop| (e.g., |uv.version()|
-is exposed as `vim.loop.version()`).
+Nvim's event-loop and is accessible from Lua via |vim.uv| (e.g., |uv.version()|
+is exposed as `vim.uv.version()`).
For information about this manual, see |luv-credits|.
@@ -29,7 +29,7 @@ TCP Echo Server Example ~
Here is a small example showing a TCP echo server:
>lua
- local uv = vim.loop
+ local uv = vim.uv
local server = uv.new_tcp()
server:bind("127.0.0.1", 1337)
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 4c864312f5..d51227f0c0 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -129,4 +129,6 @@ release.
- |nvim_win_get_option()| Use |nvim_get_option_value()| instead.
- |nvim_win_set_option()| Use |nvim_set_option_value()| instead.
+• `vim.loop` has been renamed to `vim.uv`.
+
vim:tw=78:ts=8:sw=2:et:ft=help:norl: