aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-06-04 19:32:43 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-06-05 10:46:22 +0200
commitb684bd05b513b57b4d67ea2f95f7713c0b18daab (patch)
treeefe13a5e0a42c0ca7c3589e761925960e15958ed /runtime
parent81e1dbca99c1485ab28ecb2c46d8d71a61bdb35d (diff)
downloadrneovim-b684bd05b513b57b4d67ea2f95f7713c0b18daab.tar.gz
rneovim-b684bd05b513b57b4d67ea2f95f7713c0b18daab.tar.bz2
rneovim-b684bd05b513b57b4d67ea2f95f7713c0b18daab.zip
lua: docs and tests for vim.schedule
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt2
-rw-r--r--runtime/doc/if_lua.txt6
2 files changed, 8 insertions, 0 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index e127ccae0c..a529a9b32e 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -203,6 +203,8 @@ User reloads the buffer with ":edit", emits: >
In-process lua plugins can also recieve buffer updates, in the form of lua
callbacks. These callbacks are called frequently in various contexts, buffer
contents or window layout should not be changed inside these |textlock|.
+|lua-vim.schedule| can be used to defer these operations to the main loop,
+where they are allowed.
|nvim_buf_attach| will take keyword args for the callbacks. "on_lines" will
receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline}, {new_lastline}).
diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt
index 92c25ba875..8ee5718349 100644
--- a/runtime/doc/if_lua.txt
+++ b/runtime/doc/if_lua.txt
@@ -379,6 +379,12 @@ vim.stricmp(a, b) *lua-vim.stricmp*
string arguments and returns 0, 1 or -1 if strings are equal, a is
greater then b or a is lesser then b respectively.
+vim.schedule(callback) *lua-vim.schedule*
+ Schedule `callback` to be called soon by the main event loop. This is
+ useful in contexts where some functionality is blocked, like an
+ autocommand or callback running with |textlock|. Then the scheduled
+ callback could invoke this functionality later when it is allowed.
+
vim.type_idx *lua-vim.type_idx*
Type index for use in |lua-special-tbl|. Specifying one of the
values from |lua-vim.types| allows typing the empty table (it is