summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-25 00:05:32 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-25 00:05:32 +0100
commit67a2deb9cb4ac2224cb1e4d240a5d0659f036264 (patch)
tree024c2f55f38fb92a7da3c6887dbd0c510c7ae6cb /runtime
parenta106e6cde682bda4ad10ed745acb51975fcb02e0 (diff)
patch 8.1.2341: not so easy to interrupt a script programaticallyv8.1.2341
Problem: Not so easy to interrupt a script programatically. Solution: Add the interrupt() function. (Yasuhiro Matsumoto, closes #2834)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt16
1 files changed, 15 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7c8c8d30f4..a6f56eb916 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -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: >