1
0
forked from aniani/vim

patch 8.1.2341: not so easy to interrupt a script programatically

Problem:    Not so easy to interrupt a script programatically.
Solution:   Add the interrupt() function. (Yasuhiro Matsumoto, closes #2834)
This commit is contained in:
Bram Moolenaar
2019-11-25 00:05:32 +01:00
parent a106e6cde6
commit 67a2deb9cb
6 changed files with 58 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.1. Last change: 2019 Nov 21
*eval.txt* For Vim version 8.1. Last change: 2019 Nov 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2531,6 +2531,7 @@ inputrestore() Number restore typeahead
inputsave() Number save and clear typeahead
inputsecret({prompt} [, {text}]) String like input() but hiding the text
insert({object}, {item} [, {idx}]) List insert {item} in {object} [before {idx}]
interrupt() none interrupt script execution
invert({expr}) Number bitwise invert
isdirectory({directory}) Number |TRUE| if {directory} is a directory
isinf({expr}) Number determine if {expr} is infinity value
@@ -6181,6 +6182,19 @@ insert({object}, {item} [, {idx}]) *insert()*
Can also be used as a |method|: >
mylist->insert(item)
interrupt() *interrupt()*
Interrupt script execution. It works more or less like the
user typing CTRL-C, most commands won't execute and control
returns to the user. This is useful to abort execution
from lower down, e.g. in an autocommand. Example: >
:function s:check_typoname(file)
: if fnamemodify(a:file, ':t') == '['
: echomsg 'Maybe typo'
: call interrupt()
: endif
:endfunction
:au BufWritePre * call s:check_typoname(expand('<amatch>'))
invert({expr}) *invert()*
Bitwise invert. The argument is converted to a number. A
List, Dict or Float argument causes an error. Example: >