Mercurial > vim
comparison runtime/doc/eval.txt @ 18104:e59ff7b5d7a7 v8.1.2047
patch 8.1.2047: cannot check the current state
Commit: https://github.com/vim/vim/commit/0e57dd859ecb1e8a3b91509d2f4343e839340eb8
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 16 22:56:03 2019 +0200
patch 8.1.2047: cannot check the current state
Problem: Cannot check the current state.
Solution: Add the state() function.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 16 Sep 2019 23:00:04 +0200 |
parents | a6d218f99ff7 |
children | 7f57ea9a4ba8 |
comparison
equal
deleted
inserted
replaced
18103:71bc51a0d8d8 | 18104:e59ff7b5d7a7 |
---|---|
2753 spellsuggest({word} [, {max} [, {capital}]]) | 2753 spellsuggest({word} [, {max} [, {capital}]]) |
2754 List spelling suggestions | 2754 List spelling suggestions |
2755 split({expr} [, {pat} [, {keepempty}]]) | 2755 split({expr} [, {pat} [, {keepempty}]]) |
2756 List make |List| from {pat} separated {expr} | 2756 List make |List| from {pat} separated {expr} |
2757 sqrt({expr}) Float square root of {expr} | 2757 sqrt({expr}) Float square root of {expr} |
2758 state([{what}]) String current state of Vim | |
2758 str2float({expr}) Float convert String to Float | 2759 str2float({expr}) Float convert String to Float |
2759 str2list({expr} [, {utf8}]) List convert each character of {expr} to | 2760 str2list({expr} [, {utf8}]) List convert each character of {expr} to |
2760 ASCII/UTF8 value | 2761 ASCII/UTF8 value |
2761 str2nr({expr} [, {base} [, {quoted}]]) | 2762 str2nr({expr} [, {base} [, {quoted}]]) |
2762 Number convert String to Number | 2763 Number convert String to Number |
7064 *mode()* | 7065 *mode()* |
7065 mode([expr]) Return a string that indicates the current mode. | 7066 mode([expr]) Return a string that indicates the current mode. |
7066 If [expr] is supplied and it evaluates to a non-zero Number or | 7067 If [expr] is supplied and it evaluates to a non-zero Number or |
7067 a non-empty String (|non-zero-arg|), then the full mode is | 7068 a non-empty String (|non-zero-arg|), then the full mode is |
7068 returned, otherwise only the first letter is returned. | 7069 returned, otherwise only the first letter is returned. |
7070 Also see |state()|. | |
7069 | 7071 |
7070 n Normal, Terminal-Normal | 7072 n Normal, Terminal-Normal |
7071 no Operator-pending | 7073 no Operator-pending |
7072 nov Operator-pending (forced characterwise |o_v|) | 7074 nov Operator-pending (forced characterwise |o_v|) |
7073 noV Operator-pending (forced linewise |o_V|) | 7075 noV Operator-pending (forced linewise |o_V|) |
9038 Can also be used as a |method|: > | 9040 Can also be used as a |method|: > |
9039 Compute()->sqrt() | 9041 Compute()->sqrt() |
9040 < | 9042 < |
9041 {only available when compiled with the |+float| feature} | 9043 {only available when compiled with the |+float| feature} |
9042 | 9044 |
9045 | |
9046 state([{what}]) *state()* | |
9047 Return a string which contains characters indicating the | |
9048 current state. Mostly useful in callbacks that want to do | |
9049 work that may not always be safe. Roughly this works like: | |
9050 - callback uses state() to check if work is safe to do. | |
9051 If yes, then do it right away. | |
9052 Otherwise add to work queue and add SafeState and/or | |
9053 SafeStateAgain autocommand. | |
9054 - When SafeState or SafeStateAgain is triggered, check with | |
9055 state() if the work can be done now, and if yes remove it | |
9056 from the queue and execute. | |
9057 Also see |mode()|. | |
9058 | |
9059 When {what} is given only characters in this string will be | |
9060 added. E.g, this checks if the screen has scrolled: > | |
9061 if state('s') != '' | |
9062 < | |
9063 These characters indicate the state: | |
9064 m halfway a mapping, :normal command, feedkeys() or | |
9065 stuffed command | |
9066 o operator pending or waiting for a command argument | |
9067 a Insert mode autocomplete active | |
9068 x executing an autocommand | |
9069 w blocked on waiting, e.g. ch_evalexpr() and | |
9070 ch_read(), ch_readraw() when reading json. | |
9071 c callback invoked (repeats for recursiveness up to "ccc") | |
9072 s screen has scrolled for messages | |
9043 | 9073 |
9044 str2float({expr}) *str2float()* | 9074 str2float({expr}) *str2float()* |
9045 Convert String {expr} to a Float. This mostly works the same | 9075 Convert String {expr} to a Float. This mostly works the same |
9046 as when using a floating point number in an expression, see | 9076 as when using a floating point number in an expression, see |
9047 |floating-point-format|. But it's a bit more permissive. | 9077 |floating-point-format|. But it's a bit more permissive. |