@@ -43,24 +43,32 @@ below.
43
43
44
44
* ` vim.funcs ` exposes vimscript functions (both builtin and global user defined
45
45
functions) as a python namespace. For instance to set the value of a register
46
-
47
- ` vim.funcs.setreg('0', ["some", "text"], 'l') `
48
-
46
+ ```
47
+ vim.funcs.setreg('0', ["some", "text"], 'l')
48
+ ```
49
49
* The API is not thread-safe in general. However, ` vim.async_call ` allows a
50
50
spawned thread to schedule code to be executed on the main thread. This method
51
51
could also be called from ` :python ` or a synchronous request handler, to defer
52
52
some execution that shouldn't block nvim.
53
+ ```
54
+ :python vim.async_call(myfunc, args...)
53
55
54
- ` :python vim.async_call(myfunc, args...) `
55
-
56
+ ```
56
57
Note that this code will still block the plugin host if it does long-running
57
58
computations. Intensive computations should be done in a separate thread (or
58
59
process), and ` vim.async_call ` can be used to send results back to nvim.
59
60
60
- * Some methods accept an extra keyword-only argument ` async ` : ` vim.eval ` ,
61
+ * Some methods accept an ` async ` parameter : ` vim.eval ` ,
61
62
` vim.command ` as well as the ` vim.funcs ` wrappers. The python host will not
62
- wait for nvim to complete the request, which also means that the return value
63
- is unavailable.
63
+ wait for nvim to complete the request (which also means that the return value
64
+ is unavailable).
65
+
66
+ * You can publish arbitrary events (msgpack ** notification** messages) by
67
+ passing ` async=True ` to ` vim.request() ` (this is analogous to the VimL
68
+ ` rpcnotify() ` function).
69
+ ```
70
+ vim.request("my_event", "arg1", "arg2", async=True)
71
+ ```
64
72
65
73
#### Remote (new-style) plugins
66
74
0 commit comments