aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-23 07:08:03 +0800
committerGitHub <noreply@github.com>2023-09-23 07:08:03 +0800
commitc68c121f50ee0eae7f26ed043689105086572f55 (patch)
treea474d1a8e2e5b175df1b4b6525609642760ce3d6 /runtime/doc
parentdae6770b761a5e760c6c4d7e618bb13afa961376 (diff)
parent44f698bb1afccb90fd8835fa7e35bfcebbd6d828 (diff)
downloadrneovim-c68c121f50ee0eae7f26ed043689105086572f55.tar.gz
rneovim-c68c121f50ee0eae7f26ed043689105086572f55.tar.bz2
rneovim-c68c121f50ee0eae7f26ed043689105086572f55.zip
Merge pull request #25286 from rktjmp/doc-vim-schedule-wrap
docs: add more context to vim.schedule_wrap
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/lua.txt23
1 files changed, 16 insertions, 7 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index efba10b86f..ddf11fd966 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -956,12 +956,12 @@ vim.rpcrequest({channel}, {method}, {args}, {...}) *vim.rpcrequest()*
• {args} any[]|nil
• {...} any|nil
-vim.schedule({callback}) *vim.schedule()*
- Schedules {callback} to be invoked soon by the main event-loop. Useful to
- avoid |textlock| or other temporary restrictions.
+vim.schedule({fn}) *vim.schedule()*
+ Schedules {fn} to be invoked soon by the main event-loop. Useful to avoid
+ |textlock| or other temporary restrictions.
Parameters: ~
- • {callback} fun()
+ • {fn} (function)
vim.str_byteindex({str}, {index}, {use_utf16}) *vim.str_byteindex()*
Convert UTF-32 or UTF-16 {index} to byte index. If {use_utf16} is not
@@ -1714,11 +1714,20 @@ vim.region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive})
`endcol` is exclusive, and whole lines are returned as
`{startcol,endcol} = {0,-1}`.
-vim.schedule_wrap({cb}) *vim.schedule_wrap()*
- Defers callback `cb` until the Nvim API is safe to call.
+vim.schedule_wrap({fn}) *vim.schedule_wrap()*
+ Returns a function which calls {fn} via |vim.schedule()|.
+
+ The returned function passes all arguments to {fn}.
+
+ Example: >lua
+ function notify_readable(_err, readable)
+ vim.notify("readable? " .. tostring(readable))
+ end
+ vim.uv.fs_access(vim.fn.stdpath("config"), "R", vim.schedule_wrap(notify_readable))
+<
Parameters: ~
- • {cb} (function)
+ • {fn} (function)
Return: ~
(function)