diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 11:22:25 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 14:16:16 +0800 |
commit | 64ccfdaafef56b451e3a5eed94367fad93978ec8 (patch) | |
tree | 47a238c11a2a234da43fb07cb5db6581b6a4ebcb /runtime/doc | |
parent | 4956f267449ca7526145c63ef095bfd731174635 (diff) | |
download | rneovim-64ccfdaafef56b451e3a5eed94367fad93978ec8.tar.gz rneovim-64ccfdaafef56b451e3a5eed94367fad93978ec8.tar.bz2 rneovim-64ccfdaafef56b451e3a5eed94367fad93978ec8.zip |
vim-patch:8.1.2047: cannot check the current state
Problem: Cannot check the current state.
Solution: Add the state() function.
https://github.com/vim/vim/commit/0e57dd859ecb1e8a3b91509d2f4343e839340eb8
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/builtin.txt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 92cedbdc80..c57b8637e0 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -4753,6 +4753,7 @@ mode([expr]) *mode()* If [expr] is supplied and it evaluates to a non-zero Number or a non-empty String (|non-zero-arg|), then the full mode is returned, otherwise only the first letter is returned. + Also see |state()|. n Normal no Operator-pending @@ -7368,6 +7369,31 @@ srand([{expr}]) *srand()* echo rand(seed) < +state([{what}]) *state()* + Return a string which contains characters indicating the + current state. Mostly useful in callbacks that want to do + work that may not always be safe. Roughly this works like: + - callback uses state() to check if work is safe to do. + If yes, then do it right away. + Otherwise add to work queue and add SafeState autocommand. + - When SafeState is triggered, check with state() if the work + can be done now, and if yes remove it from the queue and + execute. + Also see |mode()|. + + When {what} is given only characters in this string will be + added. E.g, this checks if the screen has scrolled: >vim + if state('s') != '' + + These characters indicate the state: + m halfway a mapping, :normal command, feedkeys() or + stuffed command + o operator pending or waiting for a command argument + a Insert mode autocomplete active + x executing an autocommand + c callback invoked (repeats for recursiveness up to "ccc") + s screen has scrolled for messages + stdioopen({opts}) *stdioopen()* With |--headless| this opens stdin and stdout as a |channel|. May be called only once. See |channel-stdio|. stderr is not |