Mercurial > vim
diff runtime/doc/eval.txt @ 18699:1febd1aa9930 v8.1.2341
patch 8.1.2341: not so easy to interrupt a script programatically
Commit: https://github.com/vim/vim/commit/67a2deb9cb4ac2224cb1e4d240a5d0659f036264
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Nov 25 00:05:32 2019 +0100
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 https://github.com/vim/vim/issues/2834)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 25 Nov 2019 00:15:06 +0100 |
parents | 9007e9896303 |
children | 128662297ddf |
line wrap: on
line diff
--- 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 typeahea 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}]) *in 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: >