VimScript:在空闲时间之后采取的动作是否有autocmd?
发布时间:2020-12-15 23:00:10 所属栏目:安全 来源:网络整理
导读:我想编写一些 vimcript,如果 vim会话空闲了一段时间就会被触发.这可能吗? 解决方法 :help CursorHoldWhen the user doesn't press a key for the timespecified with 'updatetime'. Not re-triggereduntil the user has pressed a key (i.e. doesn'tfire ev
|
我想编写一些
vimcript,如果
vim会话空闲了一段时间就会被触发.这可能吗?
解决方法:help CursorHold
When the user doesn't press a key for the time
specified with 'updatetime'. Not re-triggered
until the user has pressed a key (i.e. doesn't
fire every 'updatetime' ms if you leave Vim to
make some coffee. :) See |CursorHold-example|
for previewing tags.
This event is only triggered in Normal mode.
It is not triggered when waiting for a command
argument to be typed,or a movement after an
operator.
While recording the CursorHold event is not
triggered. |q|
Note: Interactive commands cannot be used for
this event. There is no hit-enter prompt,the screen is updated directly (when needed).
Note: In the future there will probably be
another option to set the time.
Hint: to force an update of the status lines
use: >
:let &ro = &ro
{only on Amiga,Unix,Win32,MSDOS and all GUI
versions}
*CursorHoldI*
所以,你可以试试 let g:idle_counter = 0
function! Idle()
echo "I am idle!!!! (" . g:idle_counter . ")"
let g:idle_counter = g:idle_counter + 1
endfunction
autocmd CursorHold * call Idle()
作为一个开始. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
