Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim 脚本中的错误_Vim - Fatal编程技术网

Vim 脚本中的错误

Vim 脚本中的错误,vim,Vim,我不想非得按ESC键才能切换到正常模式,所以我正在编写一个小脚本,以便在一段时间后为我完成这项工作。 但我得到了以下错误: Error detected while processing InsertEnter Auto commands for "*": E521: Number required after =: updatetime=aunm 这是剧本 let aunm=800 au InsertEnter * let aunm_restore=&updatetime | set

我不想非得按ESC键才能切换到正常模式,所以我正在编写一个小脚本,以便在一段时间后为我完成这项工作。 但我得到了以下错误:

Error detected while processing InsertEnter Auto commands for "*":
E521: Number required after =: updatetime=aunm
这是剧本

let aunm=800
au InsertEnter * let aunm_restore=&updatetime | set updatetime=aunm | au CursorHoldI * :stopinsert
au InsertLeave * let &updatetime=aunm_restore
如果我删除
让aunm=800
并手动设置
set updatetime=800
,它就可以正常工作。但如果需要,我希望有一个全局变量来更改时间。

使用

let &updatetime=aunm
<代码>设置不接受表达式


顺便说一句,我看到您的代码不断地添加CursorHoldI事件,而没有清除它们,这样您可能会得到100个事件。你应该使用

autocmd! CursorHoldI * :stopinsert
(使用bang)或只需添加一次(在au InsertEnter前面加一行),在任何情况下都不会在非插入模式下触发。注意:此命令将清除所有模式为
*
且不在任何组中的
CursorHoldI
事件,因此如果您有更多事件,则必须将它们或此事件放入
augroup{GroupName}au…| augroup END
(最好将两者都放入)