diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-08-04 21:56:29 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-08-05 13:57:24 +0200 |
commit | 88938634e7418ced4cfb074c48867523460dcc84 (patch) | |
tree | 337a13b6d292efd115856e40ed6e0f935736b59a /runtime | |
parent | e6d77993d1167f4c15c9f67c0c3281444b1d18c2 (diff) | |
download | rneovim-88938634e7418ced4cfb074c48867523460dcc84.tar.gz rneovim-88938634e7418ced4cfb074c48867523460dcc84.tar.bz2 rneovim-88938634e7418ced4cfb074c48867523460dcc84.zip |
lua: add vim.in_fast_event() to check if we are in a luv callback
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/if_lua.txt | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index f886fd28c5..7ddcb6cc92 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -400,7 +400,8 @@ is safe to execute API methods. > end)) A subset of the API is available in direct luv callbacks ("fast" callbacks), -most notably |nvim_get_mode()| and |nvim_input()|. +most notably |nvim_get_mode()| and |nvim_input()|. It is possible to +check whether code is running in this context using |vim.in_fast_event()|. Example: repeating timer @@ -462,6 +463,14 @@ 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.in_fast_event() *vim.in_fast_event()* + Returns true if the code is executing as part of a "fast" event + handler, where most of the API is disabled. These are low-level event + such as luv callbacks |lua-loop-callbacks|, which can be invoked at + any time nvim polls for input. When this returns `false` most API + functions are callable, but can be subjected to other restrictions, + such as |textlock|. + vim.type_idx *vim.type_idx* Type index for use in |lua-special-tbl|. Specifying one of the values from |vim.types| allows typing the empty table (it is |